$globals = array($_REQUEST, $_SESSION, $_SERVER, $_FILES);foreach($globals as $global){ foreach(array_keys($global) as $key){ unset(${$key}); }}
见手册:可变变量
见手册:可变变量
$globals = array(array('param1'=>'PRC','param'=>'USA'));foreach($globals as $global){ foreach(array_keys($global) as $key){ unset(${$key}); }}
你给的例子没有多大意义,这才是惯常的用法
$a = 1;$b = 2;$c = 3;foreach(array('a', 'b', 'c') as $k) echo ${$k};
你给的例子没有多大意义,这才是惯常的用法
$a = 1;$b = 2;$c = 3;foreach(array('a', 'b', 'c') as $k) echo ${$k};