I'm beginner of PHP, I found a Warning says:
Please note that variable variables cannot be used with PHP's Superglobal arrays within functions or class methods.
So, does it mean I can use variable variables with Superglobal outside of function and class methods, like this:
<?php
foreach(array('_GET','_POST','_COOKIE','_REQUEST') as $key) {
if (isset($$key)){
foreach($$key as $_key => $_value){
$$key[$_key] = MyFunc($_value);
}
}
}
function MyFunc($str){
********************
}
?>
Actually, I tried and it seems works as expected, but why PHP doesn't allow to use it inside a function or class, what is the consideration then?