PHP rand() function
This function is used to generate the random number. You can also set the specific range to generate the number.
Syntax
rand("min", "max");
Min and Max are optional values, if these values are set, then the random number will be between these values.
Example
<?php
$random1 = rand();
echo $random1;
echo '<br/>';
$random2 = rand('1', '9');
echo $random2;
?>
Output -
15824916979
Related PHP Functions
PHP array_reverse() functionPHP array_diff() function
PHP array_key_exists() function
PHP array_push() function
PHP array_search() function
PHP class_exists() function
PHP curl_setopt() function
PHP die() function
PHP dirname() function
PHP each() function
PHP explode() function
PHP file_exists() function
PHP function_exists() function
PHP getenv() function
PHP is_readable() function
PHP ksort() function
PHP mkdir() function
PHP ob_start() function
PHP parse_url() function
PHP str_repeat() function
PHP substr() function