note 102681 added to function.in-array
[email protected] Mon, 28 Feb 2011 09:33:17 -0800
| Newsgroups | php.notes |
|---|---|
| Message-ID | <[email protected]> |
strange behaviour of in_array:
If you have an array like:
$a = array(0,1,2,3,4,5);
in_array("bla", $a) returns true
in_array("bla6", $a) returns true
in_array("6bla", $a) returns false
If you have an array like (without 0):
$a = array(1,2,3,4,5);
in_array("bla", $a) returns false
in_array("6bla", $a) returns false
in_array("5bla", $a) returns true
so better use strict arg!
----
Server IP: 69.147.83.197
Probable Submitter: 212.41.196.176
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/102681
Del: integrated -- https://master.php.net/note/delete/102681/integrated
Del: useless -- https://master.php.net/note/delete/102681/useless
Del: bad code -- https://master.php.net/note/delete/102681/bad+code
Del: spam -- https://master.php.net/note/delete/102681/spam
Del: non-english -- https://master.php.net/note/delete/102681/non-english
Del: in docs -- https://master.php.net/note/delete/102681/in+docs
Del: other reasons-- https://master.php.net/note/delete/102681
Reject -- https://master.php.net/note/reject/102681
Search -- https://master.php.net/manage/user-notes.php