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!
";
}
else
{
echo "a miss!
";
}
if (in_array(0,$b))
{
echo "b bingo!
";
}
else
{
echo "b miss!
";
}
I ran it on my lamp,and got
a bingo!
b miss!
I read the manual and set the third parameter $strict
as true
,then it worked as expected.But does that mean I always need to set the strict parameter as true when using in_array
?Suggestions would be appreciated.
Regards
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…