In PHP, the rand() function means generating random integers, and the syntax is "rand(min,max)"; the parameter min is used to set the minimum value of the random number, and the parameter max is used to set the random number. The maximum value of , the return result of this function is a random integer from min to max (including min and max).
The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer
The rand in php is What does it mean
The rand function in php represents the meaning of generating random integers.
If you want a random integer between 10 and 100, inclusive, use rand (10,100).
The syntax is as follows:
rand(); or rand(min,max);
The parameter min is used to specify the minimum value of a random integer, and the parameter max is used to specify the maximum value of a random integer. Both parameters are optional.
The returned result is a random integer between min (or 0) and max (or mt_getrandmax()) (including boundary values).
Examples are as follows:
<?php echo(rand() . "<br>"); echo(rand() . "<br>"); echo(rand(10,100)); ?>
The output results are randomly as follows:
If you are interested, you can click on "PHP Video Tutorial》Learn more about PHP knowledge.
The above is the detailed content of What does rand mean in php. For more information, please follow other related articles on the PHP Chinese website!