note 43506 deleted from function.import-request-variables by aidan
| From: | aidan@php.net | Date: | Thu, 09 Sep 2004 09:13:34 +0000 |
| Subject: | note 43506 deleted from function.import-request-variables by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76285@lists.php.net to get a copy of this message | ||
Note Submitter: vlad (= at =) webtent dot ru
----
i write this function for this moment:
function var2glob(){
if (func_num_args() == 0) return false;
switch (func_get_arg(0))
{
case 'cookie': $gl_array = &$_COOKIE; break;
case 'get': $gl_array = &$_GET; break;
case 'post': $gl_array = &$_POST; break;
case 'session': $gl_array = &$_SESSION; break;
}
for ($i = 1; $i < func_num_args(); $i++){
foreach($gl_array as $arg => $val){
if ($arg == func_get_arg($i)){
$GLOBALS["$arg"] = $val;
break;
}
}
}
}
1st value is func - method
2nd..n - val names
--- use and enjoy =)