note 104501 deleted from function.in-array by cmb
| From: | cmb@php.net | Date: | Sun, 15 Sep 2019 13:14:40 +0000 |
| Subject: | note 104501 deleted from function.in-array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212205@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
known issue
when checking a string vs a integer
$testarray = array(0,1,2,3,4);
in_array("bla", $a) returns true
in_array("bla6", $a) returns true
in_array("6bla", $a) returns false
"bla" as a integer value returns the number zero
"bla6" as a integer value returns the number zero
"6bla" returns the number six as its the only vaild part of that
if you checking for unknown types eg string vs integer
then you would need the strict value to be true.