shadowline
Creating a random number takes two commands called srand and rand. srand is a preparation command for rand. It helps rand create a truely random number. rand itself creates the random number.

<?php
srand ((double) microtime( )*1000000);
$random_number = rand( );
echo "$random_number";
?>

1016369106

If you refresh this page a few times, you will notice the number in the above example will change each time. The value in the srand command is a number mixer, which is then passed into the actual rand command.

To make a random number within a specific range, you can add the number range in the rand command brackets. This example will find a number between 0 and 10 :

<?php
srand ((double) microtime( )*1000000);
$random_number = rand(0,10);
echo "$random_number";
?>

6
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow