$arr = [ 'foo'=>true, 'bar' ];
var_dump( in_array('some',$arr) );
Why var_dump returns true if some does not exists in $arr?
$arr = [ 'foo'=>true, 'bar' ];
var_dump( in_array('some',$arr) );
Why var_dump returns true if some does not exists in $arr?
in_array() check for the values of the arrays.
If you are setting a value as true, it will return true because of that, unless, as mentioned by @AymDev before, you set the third parameter to be strict.
just like this In your case
$arr = array('foo'=> 'true', 'bar' );
or
$arr = array('foo'=> 1, 'bar' );