Home >Backend Development >PHP Tutorial >瞧这段简单的代码

瞧这段简单的代码

WBOY
WBOYOriginal
2016-06-13 12:07:351008browse

看这段简单的代码?
session_start();
$globals = array($_REQUEST, $_SESSION, $_SERVER, $_FILES);
foreach ($globals as $global) {
foreach(array_keys($global) as $key) {
unset(${$key});  //这行是什么意思,就是那个${$key}   高手来看看
}
}
------解决思路----------------------
查看手册:变量的变量
------解决思路----------------------

<br />$key = "heh";<br />$heh ="woshi";<br />echo $$key;<br />//输出 woshi<br />
 
------解决思路----------------------
就是php的可变变量
如果不懂的话可以百度一下
例子:
<br />$a='abc';<br />$abc='def';<br />echo $$a;<br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn