Re: PHP 4.0 Bug #4753: in_array matches string vars as integers

From: Date: Thu, 01 Jun 2000 13:21:38 +0000
Subject: Re: PHP 4.0 Bug #4753: in_array matches string vars as integers
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-19964@lists.php.net to get a copy of this message
On Thu, 01 Jun 2000, Stanislav Malyshev wrote: > 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]). In retrospective, I guess it works this way because at the time I wrote in_array() the is_identical_function() was not yet available. It does seem proper that an identity test is used instead of smart comparison, but we can't break backward compatibility, as you pointed out. I'll add a flag, but I think it'll be used so much that it might need to be default at some point in the future... -Andrei If you find a job that you love, you'll never work another day in your life. - Mark Jackson

« previous php.dev (#19964) next »