您的位置:首页 > 其它

unset不能return 因为返回的是void

2014-01-21 16:22 295 查看
Note that since unset() returns void, you can't do this:

isset($some_var) && unset($some_var);

You'll get: Parse error: syntax error, unexpected T_UNSET in ...

The reason is because it would parse as

<bool> && <void>;

which is not a valid PHP statement.

Thus, the only alternative is to actually use if statement.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐