note 31465 added to function.in-array

From: Date: Wed, 23 Apr 2003 01:07:17 +0000
Subject: note 31465 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-46961@lists.php.net to get a copy of this message
Beware when comparing a STRING needle containing numbers to an INTEGER haystack. For example: in_array("2a7", array(2)); will return TRUE! (This is if the first number in the needle matches any of the integers in the haystack array.) I don't know if this is a bug or a feature, but can be very frustrating. -- http://www.php.net/manual/en/function.in-array.php http://master.php.net/manage/user-notes.php?action=edit+31465 http://master.php.net/manage/user-notes.php?action=delete+31465 http://master.php.net/manage/user-notes.php?action=reject+31465

« previous php.notes (#46961) next »