You can use a (base) object Comparable with a method compareTo as the callback
function for http://php.net/usort
That gives you 99% of what you want, for the tiny price of having to pass in
the array('Comparable','compareTo') as the callback arg.
Given that one frequently calls usort and friends on arrays of data that are
NOT objects at all, and, arguably, even on arrays of disparate objects or
objects and non-objects, what would you expect to happen?
usort(array(new Foo, new Bar, 42, new Baz, 'expected outcome?'));
Assume Foo, Bar, and Baz all have different/unique incompatible compareTo
methods.
PHP is not Java.
Trying to force it to do things the Java way means you probably need to spend
more time understanding the preceding sentence.
:-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php