【发布时间】:2015-05-17 10:08:47
【问题描述】:
谁能告诉我为什么string定义的变量不存在?
$string = 'variable';
${$string} = NULL;
echo $variable;
变量 $variable 未定义。
【问题讨论】:
-
来自手册:
Returns TRUE if var exists and has value other than NULL, FALSE otherwise.isset -
可以,但是为什么变量不存在?
-
@KrzysztofTrzos ^ 你读了吗? 并且具有 NULL 以外的值你的变量是 NULL,所以它是假的
-
我知道 ISSET 的工作原理。我只想知道为什么没有定义变量,当我按照我展示的方式定义它时?
-
因为
null是不存在的值