unset -- 释放给定的变量
,destroys the specified variables.
void
unset ( mixed var [, mixed var [, ...]])
unset() 销毁指定的变量
,
unset() destroys the specified variables.
The behavior of unset() inside of a function
can vary depending on what type of variable you are attempting to
destroy.
If a globalized variable is unset() inside of
a function, only the local variable is destroyed. The variable
in the calling environment will retain the same value as before
unset() was called.
<?php
if (isset($_SESSION['message']))
{
echo "<b>". $_SESSION['message']."</b>";
unset($_SESSION['message']);
}
?>
本人注解:unset只相对于自己本身的作用域内有效,如果一下情况则只是销毁了函数内部的变量
Examples
output:
bar