get random value and key from array uisng php
I have written a function to get the set of random key and value from the array.
function random_array_element(&$a){mt_srand((double)microtime()*1000000);// get all array keys:$k = array_keys($a);//print_r($k);// find a random array key:$r = mt_rand(0, count($k)-1);$rk = $k[$r];// return the random key (if exists):$Value = isset($a[$rk]) ? $a[$rk] : ”;if(!empty($Value)){$kevalueSet = “$rk:$Value”;return $kevalueSet;}else{//call the same function or echo}}
it will return Key and value set randomly from array like
135:http://humboldt.craigslist.org
so you can explode the above value an get the Array Key and Respective value randomly using php
thanks






