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

瞧这段简单的代码

WBOY
Release: 2016-06-13 12:07:35
Original
1014 people have browsed it

看这段简单的代码?
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 />
Copy after login

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template