Sodium Dreams
 

Transitivity? We Don’t Need No Stinkin’ Transitivity!

I want to stop posting these. I really do.

// The setup.

class Foo {}

$array = array();
$object = new Foo();

$array > 100;       // This is true.
100 > $object;      // This is also true. (Wha?)

// The punchline.

$array > $object;   // THIS IS FALSE!

If $array > 100 and 100 > $object, shouldn’t $array > $object? Also, doesn’t the language documenation say that when comparing an object to any other type, the object is always greater? What the fuck, PHP?

Jan 25, 2010#programming