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

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

WBOY
Release: 2016-06-23 14:28:05
Original
1047 people have browsed it

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

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


回复讨论(解决方案)

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template