note 73230 added to function.in-array

From: Date: Wed, 14 Feb 2007 10:07:08 +0000
Subject: note 73230 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-123355@lists.php.net to get a copy of this message
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. ---- Server IP: 130.206.1.5 Probable Submitter: 88.26.103.165 ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/73230 Del: integrated -- https://master.php.net/note/delete/73230/integrated Del: useless -- https://master.php.net/note/delete/73230/useless Del: bad code -- https://master.php.net/note/delete/73230/bad+code Del: spam -- https://master.php.net/note/delete/73230/spam Del: non-english -- https://master.php.net/note/delete/73230/non-english Del: in docs -- https://master.php.net/note/delete/73230/in+docs Del: other reasons-- https://master.php.net/note/delete/73230 Reject -- https://master.php.net/note/reject/73230 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123355) next »