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

看这段简单的代码?

WBOY
Release: 2016-06-23 13:48:14
Original
881 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}   高手来看看
}
}


回复讨论(解决方案)

查看手册:变量的变量

能说具体点吗,变量的变量,谁的变量的变量

$key = 'str';
${$key}  => $str

$key = "heh";$heh ="woshi";echo $$key;//输出 woshi
Copy after login

就是php的可变变量
如果不懂的话可以百度一下
例子:

$a='abc';$abc='def';echo $$a;
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