java程序员学php – 2. 非布尔类型可强行用作布尔类型

只要数据不是0,那它就可以当作true来用; 否则,就当作false来用。

if("abc") {

   echo "abc"; //will print "abc"

}

if(!"0"){

   echo "zero"; //will print "zero"

}

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.