Home >Backend Development >PHP Tutorial >java软件工程师学php - 2. 非布尔类型可强行用作布尔类型

java软件工程师学php - 2. 非布尔类型可强行用作布尔类型

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:50:10861browse

java程序员学php - 2. 非布尔类型可强行用作布尔类型
只要数据不是0,那它就可以当作true来用; 否则,就当作false来用。

if("abc") {
   echo "abc"; //will print "abc"
}

if(!"0"){
   echo "zero"; //will print "zero"
}

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