For comparison about two objects in a class, you can use an interface like this and customize your functions for each class:
<?php
interface EQU {
public static function compare( EQU $me, EQU $you );
public function equals( EQU $you );
}
?>
If you gotcha a super class, you can make generic functions (not safe but work with not complex class):
<?php
abstract class SuperClass {
public function __construct( ) {
}
public static function compare( $obj1, $obj2 ) {
return serialize( $obj1 ) == serialize( $obj2 );
}
public function equals( $obj ) {
return static::compare( $this, $obj );
}
}
?>