Voting

: max(six, two)?
(Example: nine)

The Note You're Voting On

nhuhoai
11 years ago
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( ) {
// do what you need
}
public static function
compare( $obj1, $obj2 ) {
return
serialize( $obj1 ) == serialize( $obj2 );
}
public function
equals( $obj ) {
return static::
compare( $this, $obj );
}
}
?>

<< Back to user notes page

To Top