View Single Post
  #10 (permalink)  
Old 08-16-2007, 01:29 AM
raj raj is offline
D-Web Programmer
 
Join Date: Jul 2007
Posts: 89
raj is on a distinguished road
Post Info Array Random Entry

hi,

array_rand function gets the random values from an array.

$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");

$rand_keys = array_rand($input, 2);
//#-- 1st parameter is Array for your random entries
//#-- 2nd Parameter is number of picked element, ie, how many random you
//# want to get from this array

echo $input[$rand_keys[0]] . "\n";
echo $input[$rand_keys[1]] . "\n";
Reply With Quote