Created
March 15, 2011 12:27
-
-
Save jacobch/870664 to your computer and use it in GitHub Desktop.
Comparing PHP Objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyInt { | |
private $value = 0; | |
public function __construct($value) { | |
$this->value = $value; | |
} | |
} | |
$a = new MyInt(10); | |
$b = new MyInt(20); | |
var_dump($a == $b, $a < $b, $a > $b); | |
/* | |
Outputs: | |
boolean false | |
boolean true | |
boolean false | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment