Bug #14343: in_array wrongly matches zero

From: Date: Tue, 04 Dec 2001 20:37:18 +0000
Subject: Bug #14343: in_array wrongly matches zero
Groups: php.dev 
Request: Send a blank email to php-dev+get-72501@lists.php.net to get a copy of this message
From: davidw@ensky.com Operating system: Linux/PPC PHP version: 4.0.5 PHP Bug Type: Arrays related Bug description: in_array wrongly matches zero On my system, in_array wrongly returns true when searching for zero in arrays that don't contain zero: Sample code: in_array(0, array('foobar')); -->TRUE If I add the third parameter, it returns the correct result: print in_array(0, array('foobar'), true); -->FALSE However, I'm pretty sure that 0 doesn't coerce to 'foobar' - I don't think PHP is that loosely-typed :) -- Edit bug report at: http://bugs.php.net/?id=14343&edit=1

« previous php.dev (#72501) next »