php 手册运算符中有介绍:
比较多种类型 --
如 var_dump([]> 0); // 结果为 true
运算数 1 类型 | 运算数 2 类型 | 结果 |
---|---|---|
null 或 & nbsp;string | string | 将 & nbsp;NULL 转换为 "",进行数字或词汇比较 |
bool 或 & nbsp;null | 任何其它类型 | 转换为 & nbsp;bool,FALSE < TRUE |
object | object | 内置类可以定义自己的比较,不同类不能比较,相同类和数组同样方式比较属性(PHP 4 中),PHP 5 有其自己的说明 |
string,resource 或 & nbsp;number | string,resource 或 & nbsp;number | 将字符串和资源转换成数字,按普通数字比较 |
array | array | 具有较少成员的数组较小,如果运算数 1 中的键不存在于运算数 2 中则数组无法比较,否则挨个值比较 |
object | 任何其它类型 | object 总是更大 |
array | 任何其它类型 | array 总是更大 |
来源: http://www.bubuko.com/infodetail-2690944.html