note 102681 deleted from function.in-array by cmb
| From: | cmb@php.net | Date: | Mon, 08 Jun 2015 17:48:40 +0000 |
| Subject: | note 102681 deleted from function.in-array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-202770@lists.php.net to get a copy of this message | ||
Note Submitter: Sascha Luedi
----
strange behaviour of in_array:
If you have an array like:
<?php
$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):
<?php
$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!