Posted by tony on 04/15/06 23:43
In article <1145117876.799548.249800@v46g2000cwv.googlegroups.com>,
damirz@gmail.com says...
> Actually, you cannot use superglobal arrays as variable variables:
>
> >From PHP manual:
> http://www.php.net/manual/en/language.variables.predefined.php
>
> "Variable variables: Superglobals cannot be used as variable variables
> inside functions or class methods."
>
>
Oh bugger.
Thanks for that.
I was just trying to get all the superglobals to echo out to the browser
without having to code every one seperately...
something like:
function showthisarray($nextGlobal) {
echo($nextGlobal . "\n"); // debug line
foreach($nextGlobal as $k => $v ) {
echo($k . " = " . $v . "\n");
}
}
The idea being to just pass the array names in sequence or as selected.
The function does get the name of the relevant array as the first echo
prints it ok eg . $_GET or whatever as is passed into $nextGlobal
But the foreach() function just generates a bad parameter error.
I guess it will have to be the long winded solution.
tony
[Back to original message]
|