Date: 08/23/02
- Next message: sniper <email protected>: "[PHP-DOC] #15479 [Opn->Csd]: problem referencing $_GET using a variable"
- Previous message: Markus Fischer: "[PHP-DOC] cvs: phpdoc /en/reference/mail/functions mail.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 17017
Updated by: sniper <email protected>
Reported By: lennart.mulder <email protected>
-Status: Duplicate
+Status: Closed
Bug Type: Documentation problem
Operating System: Any
PHP Version: 4.1 and higher
New Comment:
Documented here:
http://www.php.net/manual/en/language.variables.variable.php
Previous Comments:
------------------------------------------------------------------------
[2002-05-05 13:12:17] mfischer <email protected>
Reclassified as documentation problem, updated subject.
------------------------------------------------------------------------
[2002-05-05 13:00:19] mfischer <email protected>
Known limitation.
I don't know yet if this has been documented already, there's another
report about this issue though.
Marking as duplicate for now.
------------------------------------------------------------------------
[2002-05-05 12:58:27] lennart.mulder <email protected>
Hello :-)
The definition of a variable variable as superglobal works fine when
put in the main coding (i.e. not within a function or method).
Example:
<?php
$aVariable = 'GET';
echo ${"_{$aVariable}"};
?>
The system output is: Array
In the next example however, where the same code is put into a
function, the resulting output is a error message instead:
<?php
function aFunction()
{
$aVariable = 'GET';
echo ${"_{$aVariable}"};
}
aFunction();
?>
The system output is: Notice: Undefined variable: _GET in Bestand.php
on line 6.
Also when $_GET has been defined as global (which should not be
necessary) this malfunction remains.
Suggested intermediate solution:
<?php
function aFunction()
{
$aVariable = 'GET';
echo $GLOBALS["_{$aVariable}"];
}
aFunction();
?>
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=17017&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: sniper <email protected>: "[PHP-DOC] #15479 [Opn->Csd]: problem referencing $_GET using a variable"
- Previous message: Markus Fischer: "[PHP-DOC] cvs: phpdoc /en/reference/mail/functions mail.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

