Re: PHP 4.0 Bug #4753: in_array matches string vars as integers
| From: | Stanislav Malyshev | Date: | Thu, 01 Jun 2000 11:19:22 +0000 |
| Subject: | Re: PHP 4.0 Bug #4753: in_array matches string vars as integers | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-19955@lists.php.net to get a copy of this message | ||
>> $a[0]="001";
>> $a[1]="003";
>> if (in_array("1", $a))
>> {
>> echo "As if<br>";
>> }
This is because actually "1" == "001". I think there should be flag for
in_array to use "identical" comaprison (===) instead of "smart" comparison
(==). Something like in_array(mixed needle, array haystack[, bool
strict]).
--
Stanislav Malyshev stas@zend.com
+972-3-6139665