note 114171 added to function.in-array
| From: | whatloosecheckingmeans | Date: | Mon, 20 Jan 2014 05:03:53 +0000 |
| Subject: | note 114171 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198284@lists.php.net to get a copy of this message | ||
In a high-voted example, an array is given that contains, amongst other things, true, false and
null, against which various variables are tested using in_array and loose checking.
It impossible to receive false as a return value from in_array using loose checking if your arrays
contains both the constants true and false. You might understandably trip over this (or the inverse
- passing boolean true to check against an array of e.g. non-empty strings), but it's certainly
not counter intuitive and makes perfect sense.
----
Server IP: 87.124.126.49
Probable Submitter: 78.149.131.38
----
Manual Page -- http://php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/114171
Del: integrated -- https://master.php.net/note/delete/114171/integrated
Del: useless -- https://master.php.net/note/delete/114171/useless
Del: bad code -- https://master.php.net/note/delete/114171/bad+code
Del: spam -- https://master.php.net/note/delete/114171/spam
Del: non-english -- https://master.php.net/note/delete/114171/non-english
Del: in docs -- https://master.php.net/note/delete/114171/in+docs
Del: other reasons-- https://master.php.net/note/delete/114171
Reject -- https://master.php.net/note/reject/114171
Search -- https://master.php.net/manage/user-notes.php