UK [r?nd] US [r?nd]

n. The padding between the heel of the shoe and the sole, edge

Plural: rands rand

php rand() function syntax

How to use the rand() function?

php rand() function means to get a random number from the parameter range. The syntax is rand(X,Y). It gets a random number from the two parameter ranges. The random number is greater than or equal to X or Less than or equal to Y

Function:Get a random number from the parameter range

Syntax:rand(X,Y)

Parameters:

ParametersDescription
X Represents the minimum number in the range
YRepresents the maximum number in the range

Instructions: Get a random number from the range of two parameters, the random number is greater than or equal to X or less than or equal to Y

php rand() function example

<?php
$i = 1;
$j = 9;
$k = rand($i,$j);
echo "取得的隨機(jī)數(shù)為".$k;
?>

Run instance?

Click the "Run instance" button to view the online instance

Output:

隨機(jī)輸出1-9之間的一個整數(shù)
<?php
echo rand(1,100);
?>

Run Instance?

Click the "Run Instance" button to view the online instance

Output:

隨機(jī)輸出1-100之間的一個整數(shù)