note 46447 added to function.rand
| From: | scyth at gu-services dot com | Date: | Tue, 12 Oct 2004 00:40:53 +0000 |
| Subject: | note 46447 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78371@lists.php.net to get a copy of this message | ||
<?php
$quotes = array('1' => 'found some kind of paradise', '2' =>
'go back to sleep', '3' => 'what am I to do?', '4' =>
'cast your demon\'s out', '5' => 'to the dead', '6'
=> "[scyth]", '7' => "Been a long road to follow");
$number = count($quotes);
$quote = rand(0, $number);
if(!empty($quotes[$quote])) {
$random_quote = $quotes[$quote];
}
else {
$random_quote = $quotes[1];
}
?>
Simple random quote system
http://ominous-minds.info
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46447
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46447&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46447&report=yes
Search -- http://master.php.net/manage/user-notes.php