PHP rand() Function is used to generate a random integer number. A rand() function is built-in function in PHP.
Syntax :
rand();
Or
rand(int $min, int $max);
Parameter,
$min : Optional. It is the lowest number. Default is 0.
$max : Optional. It is the highest number.
Return Values :
It returns integer numbers randomly between min (or 0) and max (or getrandmax()).
The rand() function is an alias of mt_rand(). The mt_rand() function generates random value and is 4 times faster than rand().
Let's see below example to understand php rand() Function in details.
Comments