php 中的if条件里面如果是数值怎么判断 和C语言一样0为假非0 为真?还是什么样?
答案:3 悬赏:60
解决时间 2021-02-19 17:07
- 提问者网友:说不出醉人情话
- 2021-02-19 03:06
php 中的if条件里面如果是数值怎么判断 和C语言一样0为假非0 为真?还是什么样?
最佳答案
- 二级知识专家网友:懂得ㄋ、沉默
- 2021-02-19 03:19
When converting to boolean, the following values are considered FALSE:
the boolean FALSE itself
the integer 0 (zero)
the float 0.0 (zero)
the empty string, and the string "0"
an array with zero elements
an object with zero member variables (PHP 4 only)
the special type NULL (including unset variables)
SimpleXML objects created from empty tags
这些,均为假,包括你问的0
the boolean FALSE itself
the integer 0 (zero)
the float 0.0 (zero)
the empty string, and the string "0"
an array with zero elements
an object with zero member variables (PHP 4 only)
the special type NULL (including unset variables)
SimpleXML objects created from empty tags
这些,均为假,包括你问的0
全部回答
- 1楼网友:承载所有颓废
- 2021-02-19 04:50
是的。可以这样判断,if($a) 。也可以直接 if($a==0){...}
- 2楼网友:晚安听书人
- 2021-02-19 03:51
数值为0的就是假,if条件中的代码就不执行,else的执行。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯