Home  >  Article  >  Backend Development  >  PHP5.5版本之前empty函数的参数只能为变量

PHP5.5版本之前empty函数的参数只能为变量

WBOY
WBOYOriginal
2016-06-20 13:03:26982browse

PHP5.5和之前的版本empty函数的不同之处,开发时需要注意,假如你的本地开发PHP版本是PHP5.5以上,而服务器低于PHP5.5,更要注意这个问题,需要的朋友可以参考下

PHP5.5版本之前,empty的参数不能为函数等复杂类型,只能是变量。

总结下empty函数的使用场景:

1.PHP 5.5之前的版本,这个函数是用来检查变量的赋值是否为0, false, 空字符串, null。任何非变量形式的参数都是导致这个函数报错。
2.PHP 5.5这个函数可以应用于任何值,而不局限于变量。可以为常量、函数返回值等等。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn