|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-08-07 05:00 UTC] wdh at allcode dot io
Description:
------------
In the test code,
if($k == 'ex') statement is malfunctioning.
the statement should be return true only at the 'ex' string, but also return true at the 0.
Test script:
---------------
$arr = [
0 => 'a',
1 => 'b',
'ex' => 'c',
];
foreach($arr as $k => $v) {
if($k == 'ex') {
echo $k;
}
}
Expected result:
----------------
ex
Actual result:
--------------
0ex
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 06:00:01 2026 UTC |
Not only in the foreach loop, the If statement produce the bug. Test script: --------------- $str = 'ex'; if($str == 0) { echo $str; } Expected result: ---------------- (no output) Actual result: -------------- ex