Following function has easily to find and retrieve value by index from multidimensional/associative array
function array_key_exists_value($searchkey, $assocarray) { $output=''; $result = array_key_exists($searchkey, $assocarray); if ($result) { $output =$assocarray[$searchkey]; } else { foreach ($assocarray as $val) { if (is_array($val)) { $output = array_key_exists_value($searchkey, $val); } } } return $output; }
No comments:
Post a Comment