ID: 46365 Updated by: [EMAIL PROTECTED] Reported By: spabox at hshhhhh dot name -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: winxp PHP Version: 5.2.6 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 Hello, read about the third parameter. (bool $strict) http://docs.php.net/array-search http://docs.php.net/array-keys Previous Comments: ------------------------------------------------------------------------ [2008-10-22 14:32:44] spambox at hshhhhh dot name in array_keys() bug too $a = array(0, 'a','a'); var_dump(array_keys($a,'a')); #array(3) { # [0]=> # int(0) # [1]=> # int(1) # [2]=> # int(2) #} ------------------------------------------------------------------------ [2008-10-22 14:28:00] spabox at hshhhhh dot name Description: ------------ bug in function array_search: when first element in array is zero, function return zero, but if null, false or sth else returning correct key. Reproduce code: --------------- $a = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'a'); var_dump($a); var_dump(array_search('a', $a)); Expected result: ---------------- int(0) Actual result: -------------- int(1) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46365&edit=1