<?PHP $arr1=array(1,2,3,4,5,6,7,8,9); $arr2=array_rand($arr1,2); foreach($arr2 as $element) echo "$element, "; //0, 7, $ret=array_rand($arr1,1); echo "$ret"; //5 $arr1=array("rice","corn","meat","fish"); $arr2=array_rand($arr1,2); foreach($arr2 as $element) echo "$element, "; //1, 3, ?>