note 32340 added to function.rand
| From: | lars at SPAMBLOCK dot noname00 dot org | Date: | Sat, 24 May 2003 01:47:29 +0000 |
| Subject: | note 32340 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-48930@lists.php.net to get a copy of this message | ||
here's a quicker way to display random text. contrary to the previous example, it will save
time and code. here's my example, a website title randomizer..
function rndtitle($stuff) {
$stuff = array("something","something else","something completely
different");
$title = rand(0, sizeof($stuff) -1);
echo $stuff[$title];
}
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32340
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32340&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32340&report=yes