|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24598 $$var doesn't work with $var="GLOBALS";
Submitted: 2003-07-10 18:29 UTC Modified: 2003-07-10 19:27 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: copraonu at hotmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.3.2 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: copraonu at hotmail dot com
New email:
PHP Version: OS:


 [2003-07-10 18:29 UTC] copraonu at hotmail dot com
I needed to get a variable's or array's value when i had it's name stored in another variable. To get it, i used $$var_name; it all functioned as expected until it came across with $GLOBALS

Reproduce code:
//doesn't work, gets nothing:
$var = "GLOBALS";
$var = $$var;

//does work: prints $GLOBALS
$var = "GLOBALS";
$var = $$var;

Expected result:
i expected output exactly like print_r($GLOBALS)'s

Actual result:
but got nothing.
I managed to get wanted result when i added
before the code;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-10 19:27 UTC]

(you can't use variable variables with superglobals..)

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC