There is an example in the video I watched today that I don't understand.

Source: Internet
Author: User
The example in the video I watched today does not understand this. 1. The $ I of the for loop condition statement below does not appear at all. what is the use of this condition?
2. there is also a small dot in front of the equal sign. I don't know why. The video says it makes sense to let it Add itself.
Thanks for the two questions.
For ($ I = 0; $ I <4; $ I ++)
{
$ Nmsg. = dechex (mt_rand (0, 15 ));
}


Reply to discussion (solution)

For ($ I = 0; $ I <4; $ I ++) {$ nmsg. = dechex (mt_rand (0, 15 ));}

The code above indicates that a 10-digit number is randomly generated from 0 to 15, and then converted to hexadecimal. A total of four loops are generated ($ I is used to control the number of loops). Each hexadecimal number is connected by a "point" (a point is used to connect a string ). The final $ nmsg result is a string consisting of four hexadecimal numbers.

For ($ I = 0; $ I <4; $ I ++) {$ nmsg. = dechex (mt_rand (0, 15 ));}

The code above indicates that a 10-digit number is randomly generated from 0 to 15, and then converted to hexadecimal. A total of four loops are generated ($ I is used to control the number of loops). Each hexadecimal number is connected by a "point" (a point is used to connect a string ). The final $ nmsg result is a string consisting of four hexadecimal numbers.



Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.