php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #15479 problem referencing $_GET using a variable
Submitted: 2002-02-09 18:30 UTC Modified: 2002-08-23 21:42 UTC
From: pguillot at paanjaru dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.1 OS: Linux
Private report: No CVE-ID: None
 [2002-02-09 18:30 UTC] pguillot at paanjaru dot com
It seems that it is not possible to reference the $_GET, $_POST, etc using
a variable as in (A) :
$var_get = '_GET';
$local_get = $$var_get;

$var_http_get = 'HTTP_GET_VARS';
$local_http_get = $$var_http_get;

Now if the requested url contains &something=12

print $local_http_get['something'] . '*';     // print the string '12*'
print $local_get['something'] . '*';   // print the string '*'

But if (B) :
$local_good=&$_GET;
$var_good = 'local_good';
$var_get = $$var_good;
print $local_get['something'] . '*';   // print the string '12*'

Would it be a problem trying to reference a variable which name starts
with an underscore ?

I use this kind of syntax to check if something not allowed exists in the url,
using an array like $to_check = array( '_GET', '_POST' );

Anyway, as it's possible to use an alternative syntax (B), it is
not a __big__ problem, after all !

Keep on with a so nice job, I am still amazed about the power and speed
of Php, after more than 2 years using it, in a production environment.

Thanks a lot, and have a nice day. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-02 17:24 UTC] sniper@php.net
reclassified. (not bug but documentation issue)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 12:01:35 2025 UTC