|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-10-06 01:57 UTC] iliaa@php.net
[2004-10-06 13:40 UTC] rcnetto at yahoo dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 07:00:01 2025 UTC |
Description: ------------ I tried to check if a value existed in an array, but in_array did not return what I expected when I'm dealing with large strings (18 chars or longer). I have PHP 5.0.1 compiled with Apache 2.0.50 and DBG v2.11.26 running; Reproduce code: --------------- <?php $needle = '123456789012345671'; $arrayA = array('123456789012345672'); // check number is different var_dump(in_array($needle, $arrayA)); // the correct output is FALSE, but TRUE is printed ?> Expected result: ---------------- bool(false) OBS: $needle does not exists in $arrayA (last number is different), that's why it should return FALSE. Actual result: -------------- bool(true) Notes: when the value of the variables are letters, in_array works fine with the same quantity of chars. i.e: <?php $needle = 'abcdefghijklmnopqr1'; $arrayA = array('abcdefghijklmnopqr2'); // last char is different var_dump(in_array($needle, $arrayA)); ?>