Hello internals,
in the bug system there is an entry # 29421:
(http://bugs.php.net/bug.php?id=29421)
In short. in_array() and array_search() return the first
boolean(true) when the user looks for an element that
evaluates to true according to PHP's type juggling.
The opposite is also valid and can be very neat : one
can realize whether there are non-zero (evaluating to zero)
elements in a array with the following :
$array=array(0,0,1,0,0);var_dump(in_array(true, $array));

The example for the report :
<?php
$array = array ( 'foo' , TRUE , 'bar' ) ;
var_dump (array_search ( 'baz' , $array ) ) ;
?>
Expected result:
----------------
bool(false)

Actual result:
--------------
int(1)

Comments are welcome.

Thanks,
andrey

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to