Log in

View Full Version : exploring random numbers



sukanya.paul
05-09-2007, 04:08 AM
hi..its me again..
i hv a table for question which has id labelled from 1 and it keeps growing..
i want to generate random number but only from those numbers which hv level "easy"..
id 1 cud hv level easy while 2 has hard and 3 has medium again 5 has easy..
how do i do tht?
thanks in advance

boxxertrumps
05-09-2007, 07:00 PM
?
<?php
if ($lev = "easy") {
$num = rand();
} elseif ($lev = "medium") {
$num = 1234;
} elseif ($lev = "hard") {
$num = 5678;
} else {
echo "invalid level";
} ?>

php.net has examples of all their functions...

Also, please use have and could, make an effort to use language that cam be interpreted by people who don't speak english natively.