note 110016 added to function.array-rand
| From: | Anonymous | Date: | Wed, 12 Sep 2012 05:10:12 +0000 |
| Subject: | note 110016 added to function.array-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190645@lists.php.net to get a copy of this message | ||
//array_rand
echo "array_rand";
echo"<br>";
$input = array("Neo", "Morpheus", "Trinity", "Cypher",
"Tank");//we have only 5 value in array so we can define at maximum 5
$rand_keys = array_rand($input, 5);//5 is used for displaying the element if we define 1 we can
display only one element at a time
echo "1=".$input[$rand_keys[0]] ;
echo "<br>2=".$input[$rand_keys[1]] ;
echo "<br>3=".$input[$rand_keys[2]] ;
echo "<br>4=".$input[$rand_keys[3]] ;
echo "<br>5=".$input[$rand_keys[4]] ;
echo "<br>6=".$input[$rand_keys[5]]."only we got 5 value so it displaying only
5 value" ;
----
Server IP: 69.147.83.197
Probable Submitter: 202.191.246.206
----
Manual Page -- http://www.php.net/manual/en/function.array-rand.php
Edit -- https://master.php.net/note/edit/110016
Del: integrated -- https://master.php.net/note/delete/110016/integrated
Del: useless -- https://master.php.net/note/delete/110016/useless
Del: bad code -- https://master.php.net/note/delete/110016/bad+code
Del: spam -- https://master.php.net/note/delete/110016/spam
Del: non-english -- https://master.php.net/note/delete/110016/non-english
Del: in docs -- https://master.php.net/note/delete/110016/in+docs
Del: other reasons-- https://master.php.net/note/delete/110016
Reject -- https://master.php.net/note/reject/110016
Search -- https://master.php.net/manage/user-notes.php