I want to overload methods of comparison for a personnal class.
For example if I write this : $object1 < $object2 Php will use this function :
function compare($a, $b){
if($a->attribute == $b->attribute){return 0;}
else{return $a->attribute > $b->attribute ? 1 : -1;}
}
Is there a way to do this ?
I already seen this and this but I can't use these solutions