note 51127 added to function.array-rand

From: Date: Mon, 21 Mar 2005 03:11:57 +0000
Subject: note 51127 added to function.array-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-86731@lists.php.net to get a copy of this message
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... ---- Manual Page -- http://www.php.net/manual/en/function.array-rand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51127 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51127&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51127&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51127&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51127&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51127&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51127&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86731) next »