Dbmier LED Artcraft Tracing Light Pad Light Box Light Board Light Table- A4

PHP Tech Blog

Dbmier LED Artcraft Tracing Light Pad Light Box Light Board Light Table- A4

留言簿(5)

Links

My Favorites

推荐技术文章

阅读排行榜

评论排行榜

php unset函数怎么使用,什么意思

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

<?php
function destroy_foo() 
{
    global $foo;
    unset($foo);
}

$foo = 'bar';
destroy_foo();
echo $foo;
?>

output:
bar

posted on 2009-07-30 17:00 haix 阅读(1063) 评论(0)  编辑 收藏 引用 网摘 所属分类: PHP


只有注册用户登录后才能发表评论。
网站导航:
Dbmier LED Artcraft Tracing Light Pad Light Box Light Board Light Table- A4