Bug #13126: in_array() is type-strict by default?

From: Date: Tue, 04 Sep 2001 11:18:54 +0000
Subject: Bug #13126: in_array() is type-strict by default?
Groups: php.dev 
Request: Send a blank email to php-dev+get-65042@lists.php.net to get a copy of this message
From:             esivertsen@atmel.com
Operating system: FreeBSD
PHP version:      4.0.6
PHP Bug Type:     Arrays related
Bug description:  in_array() is type-strict by default?

It seems like the in_array() function has been slightly altered in this
(4.0.6) release compared to 4.0.3. 

A check of an array of chars against integers fail; but it didn't in
verison 4.0.3. 

example:

$char_array = array("1","2","3");

if(in_array($char_array, 2))
   $output = "FOUND";
else
   $output = "NOT FOUND";

echo $output;


----> produces the output "NOT FOUND";

Seems some typecasting is necessary this time...


              
-- 
Edit bug report at: http://bugs.php.net/?id=13126&edit=1



Thread (4 messages)

« previous php.dev (#65042) next »