2007/07 12
	function testComparison() {
		$this->assertTrue(array() == false);  // Pass
		$this->assertFalse(array() == 0); //Fail
		$this->assertFalse(array() == 1); //Fail
		$this->assertTrue(array() == null); //True
	}

根据Comparison with Various Types, 在:
bool or null anything Convert to bool, FALSE < TRUE
(bool) null == false, (bool) array() == false;
=> null == array(); false == array();


array anything array is always greater
=> array() > any number;


并不知道php为什么这么设置,明显违反了数学法则嘛。
0 == false;
array() == false;

0 == array();
不成立

Posted by rollenc

Last modified on 2007-07-12 09:53

0 Trackbacks

  1. No Trackbacks

0 Comments

  1. No comments

Add Comment


E-Mail addresses will not be displayed and will only be used for E-Mail notifications.