not sure exactly what you need, what about this: $num will have 5 random numbers, you can also put it in an array to keep the 5 numbers to use later.
Mulari is Right. Use this to generate 5 random numbers. change the number in red for your range. If you want the number to be echoed throughout the document use: <?=$num?> More Info: http://www.25x.us/?nwvuC3MKxs
Or if you need to add them or do some other form of math later do this for ($i = 0; $i < 5; $i++) { $num[$i] = rand(1,30); } echo $num[0] ; echo $num[1] ; echo $num[2] ; echo $num[3] ; echo $num[4] . "<br><br>" ; echo $num[0] + $num[1] + $num[2] + $num[3] + $num[4] ; PHP: It's nice sometimes having them in variables that you can use throughout a program