note 51127 deleted from function.array-rand by derek
| From: | derek@php.net | Date: | Wed, 11 May 2005 02:32:28 +0000 |
| Subject: | note 51127 deleted from function.array-rand by derek | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-89240@lists.php.net to get a copy of this message | ||
Note Submitter: red plus php minus spam at t vynce d dot t net
----
am i missing something obvious? is there some reason not to do this?
<CODE>
$magicwords = array("abracadabra", "hocus pocus", "shazam",
"twix");
$randitem = $magicwords[array_rand($magicwords)];
print "If $randitem doesn't work, try 'Please.'\n";
</CODE>
it seems like the perfect use for this function, but nobody seems to mention it...