ID: 44213 Updated by: [EMAIL PROTECTED] Reported By: markus dot kalkbrenner at arcor dot de -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Linux PHP Version: 5.2.5 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This result is expected. In "a" == 0, "a" is converted to int. For strict comparison, use the third parameter. http://docs.php.net/in-array Previous Comments: ------------------------------------------------------------------------ [2008-02-22 12:24:14] markus dot kalkbrenner at arcor dot de Description: ------------ in_array() returns true if needle exists as key with int(0) as value, but should return false because needle doesn't exist as value. Reproduce code: --------------- <?php var_dump( in_array('a', array('a' => 1) ) ); var_dump( in_array('a', array('a' => 0) ) ); ?> Expected result: ---------------- bool(false) bool(false) Actual result: -------------- bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44213&edit=1