Skip to content

Instantly share code, notes, and snippets.

@jacobch
Created March 15, 2011 12:27
Show Gist options
  • Save jacobch/870664 to your computer and use it in GitHub Desktop.
Save jacobch/870664 to your computer and use it in GitHub Desktop.
Comparing PHP Objects
<?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