AW: Bug #13363 Updated: variable variables with arrays
| From: | Irfan Haydarlioglu | Date: | Tue, 18 Sep 2001 14:59:43 +0000 |
| Subject: | AW: Bug #13363 Updated: variable variables with arrays | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-66196@lists.php.net to get a copy of this message | ||
Hi
yes I know the Probl. with $GLOBALS but does it work with other Arrays?
No it doesn't ! This is why I wonder!
-----Ursprüngliche Nachricht-----
Von: Bug Database [mailto:php-dev@lists.php.net]
Gesendet: Dienstag, 18. September 2001 14:25
An: developer@jaaboo.com
Betreff: Bug #13363 Updated: variable variables with arrays
ID: 13363
Updated by: hholzgra
Reported By: developer@jaaboo.com
Status: Open
Old Bug Type: Scripting Engine problem
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.0.6
New Comment:
$$ is just a shortcut for a lookup in the variable hashtable
of the current namespace ($GLOABLS if outside a function)
so you end up with the equivalent of $GLOBALS["GLOBALS[first][second]"]
which is obviously not supposed to work as a multidimensional array access
IMHO $$ should *not* become to clever aka. complicated
moved to feature requests for now although the amount of
exclamation marks used almost justified bogusification
Previous Comments:
------------------------------------------------------------------------
[2001-09-18 07:50:44] developer@jaaboo.com
$dynvar = "GLOBALS[first][second]";
echo $$dynvar;
result : nothing , no error and no output!
for arrays stored in variables only to ways are working:
$dynvar = "GLOBALS";
echo ${$dynvar[first][second]};
or more dynamic but more slower!
$dynvar = "<"."?PHP echo \$GLOBALS[first][second]; ?".">";
eval $dynvar;
you can use a variable to store instead of echo!
I think this breaks the rules of assigning variable variables . It must be
possible to store the complete call of the array in a variable.
The Way implemented jet is not praktical!!!!! Real World Tested! There are
so much postings in many Forums and Mailinglist with no suggestion . I can't
understand this! So i must think this is a BUG! or was forgotten to realize!
------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at
http://bugs.php.net/?id=13363&edit=2