note 15192 added to function.mt-rand
| From: | jamesmc at jamesmc dot org | Date: | Fri, 31 Aug 2001 04:46:31 +0000 |
| Subject: | note 15192 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17417@lists.php.net to get a copy of this message | ||
Here is a quick hack for a random item generator, substitute the array for your own values, of
course...
<?
$a = array("item 1","item 2","item 3","item 4","item
5","item 6","item 7","item 8");
mt_srand ((float) microtime() * 1000000);
$r = mt_rand(0,7);
print"Random Value for today is: $a[$r]";
?>
Have a good one!
http://www.php.net/manual/en/function.mt-rand.php