This is weird thing I found with array_search()
;
$test = array(
1 => 'first',
2 => 'second'
);
Now if the needle to be searched comes as 0 For eg:
$val = 0;
$key = array_search($val, $test);
Now $key
is returned as 1
(the first key).
Does anyone know how to deal with such behaviour and return false
for this check ? Is it documented anywhere ? I've searched but not found even on SO.
Thanks!