PHP Math Function : rand()

The rand() function is used to generates a random integer number. The syntax is as follows :
 rand();
Or
 rand(min,max);
Where min specifies the lowest number to be returned and max specifies the highest number to be returned. The default min is 0 and default max is 32767 (through getrandmax() ).

Example :
<?php

  echo rand() . "<br/>";
  echo rand() . "<br/><br/>";

  echo rand(10, 20) . "<br/>";
  echo rand(500, 600) . "<br/>";

?>
Output :

1392993020
1398631623

11
567

Next Topic :