|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-13 22:23 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 11:00:02 2026 UTC |
Description: ------------ If int 0 is used as an array_search or in_array needle and int 0 is not an element in the haystack, array_search and in_array will return int 0 and boolean true, respectively, instead of boolean false as expected. Reproduce code: --------------- $array = array('x', 'y', 'z'); var_dump(array_search(0, $array)); var_dump(in_array(0, $array)); Expected result: ---------------- var_dump and in_array should have spit out boolean(false) since int 0 is not in array $array. Actual result: -------------- int(0) bool(true)