I need to store the value of the generated random number inside a variable. e.g.
<?php
$randomnumber = rand('1000','9999'); //This will give me a four-digit random number.
echo "Number 1: ".$randomnumber;
echo "Number 1: ".$randomnumber;
?>
But the problem occurs when i run this:
Number 1: 1874
Number 2: 3624
It re-generates another random number when i try to use the variable again. How do i generate a number then store the random number in a variable so i can use the same variable(with the same number) again and again?
<?php
$randomnumber = rand('1000','9999'); //This will give me a four-digit random number.
echo "Number 1: ".$randomnumber;
echo "Number 1: ".$randomnumber;
?>
But the problem occurs when i run this:
Number 1: 1874
Number 2: 3624
It re-generates another random number when i try to use the variable again. How do i generate a number then store the random number in a variable so i can use the same variable(with the same number) again and again?