PHP Random Digit
Sunday, 17. September 2006, 03:42:30
PHP Random Function :
rand([int_min], [int_max]);
Example :
rand(1, 999);
The code shown above will create a random number between 1 (which is the minimum) and 999 (which is the maximum).
You can make the [min] and [max] values of this function dynamic, simply by replacing the digits with your variables. You can also assign this function to a variable itself and ouput the results if needed. See the simple example below :
$min = 1; $max = 99; $random_number = rand($min, $max); echo "$random_number";
I wouldn't say that this function is really used that often, but it definitely comes in handy from time to time. Enjoy!
















satya61229 # 5. September 2009, 04:09
Unique Id each time
and
Serial no. for transaction order