看看下面的代码:
<?php
$a = 20;
$a= NULL; //or unset($a)
if(isset($a))
{
print("hi");
}
else
{
echo "not initiated";
}
if(isset($b)) //$b is a variable which is not initialized
{
print("hi");
}
else
{
echo "not initiated";
}
?>
Run Code Online (Sandbox Code Playgroud)
当应用未设置时,我得到相同的结果:
那么,分配NULL和取消设置有什么区别?
php ×1