note 73230 rejected from function.in-array by tularis
| From: | tularis@php.net | Date: | Wed, 14 Feb 2007 10:48:41 +0000 |
| Subject: | note 73230 rejected from function.in-array by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123361@lists.php.net to get a copy of this message | ||
Note Submitter: ditiem at gmail dot com
----
I have found something strange in in_array function:
<?php
echo in_array( "hi", array( 0 ) )? "in " : "out " ;
echo in_array( "hi", array( "" ) )? "in " : "out " ;
?>
The output is:
in out
what means that the string "hi" is in an array that
contains a 0. Is this a bug or it has some logical
explanation that I am missing?
PS: The first in turns out if the third argument of
in_array is set to TRUE.