note 115033 rejected from function.in-array by cmb
| From: | cmb@php.net | Date: | Sun, 15 Sep 2019 13:12:48 +0000 |
| Subject: | note 115033 rejected from function.in-array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212201@lists.php.net to get a copy of this message | ||
Note Submitter: i dot pinz1 at gmail dot com
----
I have noted some strange behavior of the in_array() function if you have a hash like
$haystack=array (
'123'=>'some value',
'0125'=>'some value');
If I test now:
if (in_array('23',$haystack)) // here also TRUE is returned
I switched instead to
if(isset($haystack['23'])) // which return correct FALSE
Maybe this helps others too.