i have a problem with using in_array function
$set_array[0]=array('Name'=>'Sanu',
'Cast'=>'Manandhar'
);
$set_array[1]=array('Name'=>'Kishor',
'Cast'=>'Pradhan'
);
$set_array[2]=array('Name'=>'Prabod',
'Cast'=>'Shrestha'
);
while(list($index,$content)=each($set_array)){
//Problem is Here
if(in_array('Sanu',$content['Name'])) print("-".$content['Name']."<BR>");
else print("".$content['Name']."<BR>");
}
output is
Warning: Wrong datatype for second argument in call to in_array() in D:\sanudesktop\yesnepal\chain\class.php on line 15
Sanu
Warning: Wrong datatype for second argument in call to in_array() in D:\sanudesktop\yesnepal\chain\class.php on line 15
Kishor
Warning: Wrong datatype for second argument in call to in_array() in D:\sanudesktop\yesnepal\chain\class.php on line 15
Prabod
Instead of
if(in_array('Sanu',$content['Name'])) print("-".$content['Name']."<BR>");
if i use
if(in_array('Sanu',$content)) print("-".$content['Name']."<BR>");
it give output but what i want is to look at only Name
please help me