public static function compare($val1, $val2)
    {
        if(in_array(self::getQualifiedType($val1), array('int','boolean', 'float', 'NULL')) )
            return $val1 == $val2 ? 0 : (($val1 < $val2) ? -1 : 1);
        // if(self::getQualifiedType($val1) == 'string' )
            // return strcmp($val1, $val2);
        if(self::isSubclass($val1, 'Date'))
            return self::compare($val1->toUnix(), $val2->toUnix());

        return strcmp((string)$val1, (string)$val2);
    }
public static function compare($val1, $val2)
    {
        if(in_array(self::getQualifiedType($val1), array('int','boolean', 'float', 'NULL')) )
            return $val1 == $val2 ? 0 : (($val1 < $val2) ? -1 : 1);
        // if(self::getQualifiedType($val1) == 'string' )
            // return strcmp($val1, $val2);
        if(self::isSubclass($val1, 'Date'))
            return self::compare($val1->toUnix(), $val2->toUnix());

        return strcmp((string)$val1, (string)$val2);
    }
public static function compare ( $ val1 , $ val2 ) { if ( in_array ( self :: getQualifiedType ( $ val1 ) , array ( 'int' , 'boolean' , 'float' , 'NULL' ) ) ) return $ val1 == $ val2 ? 0 : ( ( $ val1 < $ val2 ) ? - 1 : 1 ) ; // if(self::getQualifiedType($val1) == 'string' ) // return strcmp($val1, $val2); if ( self :: isSubclass ( $ val1 , 'Date' ) ) return self :: compare ( $ val1 -> toUnix ( ) , $ val2 -> toUnix ( ) ) ; return strcmp ( ( string ) $ val1 , ( string ) $ val2 ) ; }
Compare two items for equivalence. Supports Date objects and all native types.

@param mixed $val1 The first value
@param mixed $val2 The second value

@return boolean Will be true if the items are equivalent.
Compare two items for equivalence . Supports Date objects and all native types .