|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-10 10:34 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
Description: ------------ The specified code produces, at least as I see it, a false positive. Needle and haystack values are of the same type and the matching value has a different last character. When I enforce the type test by setting the strict parameter to true, the result is correct : Not found. (I tested this on different PHP 4.X and 5.X installations on Windows and Linux, all produce the same result) Reproduce code: --------------- $arr_ean=array('333333333333333333','541448820060826105','444444444444444444'); $pos=array_search('541448820060826106',$arr_ean); if($pos===FALSE) { echo "Not found"; } else { echo "Found at key : $pos"; } Expected result: ---------------- Not found Actual result: -------------- Found at key : 1