Is there any php function such as in_array for associative arrays you get by the mysql function \"mysql_fetch assoc\" ?
For example, if I have an $array that looks l
You can't do it directly on nested arrays.. You need to nest it down a bit and then do it.
array('ID'=>1, 'name'=>"Smith"), 1=>array('ID'=>2, 'name'=>"John"));
foreach($arr as $arr1)
{
if(in_array(1,$arr1))
{
echo "Yes found.. and the correspoding key is ".key($arr1)." and the employee is ".$arr1['name'];
}
}
OUTPUT :
Yes found.. and the correspoding key is ID and the employee is Smith