I am testing a php function i found on the php documentation based on this comment: http://www.php.net/manual/en/function.rand.php#108861
<?php
function RandNumber($e) {
for ($i = 0; $i < $e; $i++) {
$rand = $rand . rand(0, 9);
}
return $rand;
}
echo RandNumber(4);
// Outputs a 6 digit random number
?>
I get the error Notice:
Undefined variable: rand in /var/www/eod.php on line 7
This is line 7:
$rand = $rand . rand(0, 9);
Why is causing this error since the function works as expected?