A problem about in_array
- by SpawnCxy
Hi all,
I have got a strange problem about in_array recently which I cannot understand.
e.g.
$a = array('a','b','c');
$b = array(1,2,3);
if (in_array(0,$a))
{
echo "a bingo!\n";
}
else
{
echo "a miss!\n";
}
if (in_array(0,$b))
{
echo "b bingo!\n";
}
else
{
echo "b miss!\n";
}
I ran it on my lamp,and got
a bingo!
b miss!
I read the manual and set the third parament $strict as true,then it worked as expected.But does that mean I always need to set the strict parament as true when using in_array?Suggestions would be appreciated.
Regards