|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-10 09:35 UTC] feng_evan at yahoo dot com
Description:
------------
Array index value judgments must use absolute equal?
Test script:
---------------
$arr = array();
$arr['0'] = 'zero';
$arr['keyword'] = 'keyword';
foreach($arr as $key => $val) {
if ($key == 'keyword') {
//if ($key === 'keyword') { //ok
echo $val."\n";
}
}
//output:zero keyword
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 01:00:01 2025 UTC |
Well people expect that this will work: $list = array('foo', 'bar', 'baz'); $value = $list[$_GET['id']]; And well, the behavior is like that >10 years even if it might be considered bad breaking it is worse.