note 50704 deleted from function.in-array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:55:20 +0000 |
| Subject: | note 50704 deleted from function.in-array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134480@lists.php.net to get a copy of this message | ||
Note Submitter: Chris
----
I hope everyone sees that the previous poster's comments are incorrect, in that the behavior is
not ridiculous but completely as expected.
> in_array('123abc', array(123)) returns true
A string is being compared to an integer, in such a situation PHP assumes an integer context wherein
'123abc' evaluates to the integer 123, thus a match.
> in_array('123abc', array('123')) returns false
A string is being compared to a string and OBVIOUSLY these strings are not equal.