Hi. I am wondering if rand() is a proper function in PHP. I have a script (below), but for some reason no random number is being generated. Any ideas please? I'm a Perl programmer by nature, so i may have done something stupid that would cause it not to work :-/
Thanks
Andy
Code:
<?php
/*
*/
$min = 1; $max = 50;
$get_number = $guess;
$rand_number = rand($mins, $max);
if ($rand_number == $get_number) { good($get_number); } else { bad($get_number); }
function good($number)
{
echo "Your number was right ($number)";
echo "The answer was" . $rand_number;
} # end the good sub.
function bad($number)
{
echo "Your number was wrong ($number)";
echo "The answer was" . $rand_number;
} # end the bad sub.
?>
Thanks
Andy