|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-10-22 14:28 UTC] 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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 17:00:01 2025 UTC |
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) #}