Home >Backend Development >PHP Tutorial >用strlen判断是否为空是不是比较好

用strlen判断是否为空是不是比较好

WBOY
WBOYOriginal
2016-06-23 14:28:051038browse

(在值为0时也不是空的需求下)像这样
if(strlen($this->m)!=0)
用strlen判断是否为空是不是比较好?

=='' 或==='' 在为0或未赋值等各种情况时的表现不容易记住


回复讨论(解决方案)

if ($this->m != ""){
    //do
}

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
Previous article:cookie和session的加密?Next article:关于连接缓存?