php为什么array()!=0

WBOY
Release: 2016-06-06 20:30:24
Original
1323 people have browsed it

array() == false
0 == false
'' == false
0 == ''
但是问题来了
为什么
array() != 0
array() != ''

回复内容:

array() == false
0 == false
'' == false
0 == ''
但是问题来了
为什么
array() != 0
array() != ''

php为什么array()!=0

图片出自:http://php.net/manual/zh/types.comparisons.php

这样的比较结果与php的内部机制有关,现在理解不了也没关系,当作规则记住即可.

array() != 0
array() != ''

数组肯定不可以直接和int、string类型比较啊。

谁告诉你==!=两个运算符具有传递性了。1和2都==true,难道1就要等于2吗?

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!