I tried to get the name of a superglobal variable through the GET parameter. I was transferred only _VAR_NAME(no $) to get the request, so the program I need to be accessed through the variable variable to him $$_GET['parameter_name'].
Everything went fine except $_SERVER. To try what was wrong, I just made a small PHP script to check what was going on. Here is the code:
<?php
$nombre = "_SERVER";
$var = $$nombre;
print_r($var);
$nombre = "_GET";
$var = $$nombre;
print_r($var);
?>
Is there a reason why the version is _SERVERnot working? I get the following error:
Note: Undefined variable: _SERVERin ...
source
share