There are short way to random element
$random = array( "one" => array("one", "two"), "two" => array("three", "four"), "three" => array("five", "six"), "four" => array("five", "six"), "five" => array("five", "six") );
$section = array_rand($random); //here yoy get random first of array(one or two or three or four or five) echo $random[$section][array_rand($random[$section])]; //here you get random element of this array
Question and answer is powered by AnsPress.io