Math Rand in PHP

In this article I am going to explain PHP math rand function.
  • 1920


The PHP math functions are used to handle values within the range of integer and float types. In this article I describe some more of the PHP math functions. 

PHP Rand() function

The PHP rand function generates a random integer. If you call rand without a parameter then it will return a random integer between 0 and RAND_MAX.


rand  (min, max)

Parameters in Rand function

It has two parameters; they are:

Parameter Description
min It specifies minimum range as a integer.
max It specifies maximum range as a integer.

Example of Rand function 


echo ("Random number without the range: "rand() ."</br>");

echo ("Random number between 10 to 100: ".rand(10,100)."</br>");





More Articles

© 2020 DotNetHeaven. All rights reserved.