ID: 46786
Comment by: caoxingk at gmail dot com
Reported By: caoxingk at gmail dot com
Status: Open
Bug Type: Unknown/Other Function
Operating System: win_nt
PHP Version: 5.2.7
New Comment:
Hope it's not my personal-logic-problem...
Previous Comments:
------------------------------------------------------------------------
[2008-12-06 17:50:47] caoxingk at gmail dot com
Description:
------------
<pre>
file NumericVarName.php
<?php
$TestVar = 8888;
$$TestVar = 'See the KEY\'s type...';
$SeeThis = get_defined_vars();
function MyEcho($_Msg) {echo '<script>alert(\'' . $_Msg .
'\');</script>';}
isset($$TestVar) && MyEcho('Case A!');
isset($SeeThis[8888]) && MyEcho('Case B!');
isset($SeeThis['8888']) && MyEcho('Case C!');
foreach ($SeeThis as $_Ui => $_Uk) {
($_Ui === 8888) && $_Temp = 'Case B too!';
($_Ui === '8888') && $_Temp = 'Case C too!';
isset($_Temp) && MyEcho($_Temp);
}
?>
------------------------------------------------------------------------------
My English is poor.Just explain my question shortly:
The output contains "Case A!" & "Case C too!",
but why not contain "Case C!" before "Case C too!" ?
------------------------------------------------------------------------------
Hope you can analyse what I've talk about,
maybe something not expect comes such as:
- syntax-parser do not check "$$var" when "$var" is numeric.
- do "foreach array" with get_defined_vars()'s return has a
shortcoming.
- ...
Wish PHP better & better...
</pre>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46786&edit=1