PHP Classes

File: Comparable.interface.php

Recommend this page to a friend!
  Classes of Azeem Michael   String Object   Comparable.interface.php   Download  
File: Comparable.interface.php
Role: Class source
Content type: text/plain
Description: The Comparable Interface
Class: String Object
Perform several string manipulation operations
Author: By
Last change: compareTo() and compareToIgnoreCase() no longer require object as a param. Any-type (primitive or object) can be compared now.
Date: 12 years ago
Size: 1,127 bytes
 

Contents

Class file image Download
<?php
/**
 * This interface imposes a total ordering on the objects of each class that implements
 * it. This ordering is referred to as the class's natural ordering, and the class's
 * compareTo method is referred to as its natural comparison method
 */
interface Comparable {
   
   
/**
     * Compares this object with the specified object for order. Returns a negative
     * integer, zero, or a positive integer as this object is less than, equal to,
     * or greater than the specified object
     *
     * @uses Compares this object with the specified object for order
     * @param mixed $o - the object to be compared
     * @return int a negative integer, zero, or a positive integer as this object is
     * less than, equal to, or greater than the specified object
     */
   
public function compareTo($o);

   
/**
     * Case Insensitive Comparator
     * @param mixed $o - the object to be compared
     * @return int a negative integer, zero, or a positive integer as this object is
     * less than, equal to, or greater than the specified object
     */
   
public function compareToIgnoreCase($o);
}
?>