note 106647 added to function.in-array
| From: | crazyone at crazycoders dot net | Date: | Thu, 24 Nov 2011 14:57:11 +0000 |
| Subject: | note 106647 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184652@lists.php.net to get a copy of this message | ||
@beingmrkenny
It's normal that 'egg' matches your array because php is not strict in it's type
comparison. This is why you have a STRICT 3rd parameter to in_array().
In your original array you have TRUE as a value, true is equal to anything that is no 0, NULL or
''. Thus, comparing any non empty value to true always returns true.
Use the strict parameter to change that behavior.
----
Server IP: 92.48.74.199
Probable Submitter: 69.70.84.22
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/106647
Del: integrated -- https://master.php.net/note/delete/106647/integrated
Del: useless -- https://master.php.net/note/delete/106647/useless
Del: bad code -- https://master.php.net/note/delete/106647/bad+code
Del: spam -- https://master.php.net/note/delete/106647/spam
Del: non-english -- https://master.php.net/note/delete/106647/non-english
Del: in docs -- https://master.php.net/note/delete/106647/in+docs
Del: other reasons-- https://master.php.net/note/delete/106647
Reject -- https://master.php.net/note/reject/106647
Search -- https://master.php.net/manage/user-notes.php