interface ComparableInterface (View source)

An object that can be compared to another.

Methods

integer
compare(mixed $value)

Compare instance with another Comparable.

Details

integer compare(mixed $value)

Compare instance with another Comparable.

Parameters

mixed $value Value to compare to instance.

Return Value

integer One of

  • < 0 If instance value is less than $value
  • 0 if instance and $value are equal
  • > 0 if instance value is greater than $value
    The meaning of "less", "equal" and "greater" depends on class value type.

Exceptions

NotComparableException:: This method MUST throw NotComparableException if $value cannot be compared to instance.