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.
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.
相关文章推荐
- return不能返回指向栈内存的指针
- jQuery在异步请求数据返回后,调用$("selector").html(data.content);之后因为一些特殊字符或者',"不能显示内容的问题解决办法
- main函数的返回值是int类型,不能是void
- 使用VS2012 MFC自定义消息时,处理函数不能返回void类型。
- 组个最小数 因为第一个数不能是0,所以先找第一个数字,从 i=1 开始找,找到后,在重新从i=0,开始输出
- try和finally中同时有return,返回顺序是怎样
- TextView setText 报错 因为 不能直接放 int 类型
- springMVC返回json格式数据报错:No converter found for return value of type: class java.util.HashMap
- ubuntu 10.04下不能更新了 报错 :已安装的 post-installation 脚本 返回了错误号 127
- 解决在MainPage中,点击实体返回按键不能退出的问题
- C++中不能返回数组的原因分析
- 支付宝支付返回通知时 notify_url和return_url的选择
- 调用Android相机裁剪图片太大不能返回的问题解决
- JDBC插入操作时,通过return返回主键
- 对于ajax请求,后端不能直接返回页面的处理方式
- 将字符串中的字符'*'移到串的前部分,前面的非'*'字 符后移,但不能改变非'*'字符的先后顺序,函数返回串中字符'*'的数量
- C3499 a lambda that has been specified to have a void return type cannot return a value
- 不能启用此约束,因为不是所有的值都具有相应的父值的解决方法
- try块中的return和finaly何时返回以及细节
- Sybase、SQL SERVER获取return返回值