usort comparison function
| From: | Matthew Kendall | Date: | Sun, 30 Jul 2000 02:26:28 +0000 |
| Subject: | usort comparison function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-9013@lists.php.net to get a copy of this message | ||
The usort function allows an array to be sorted on the basis of a
user-supplied function that compares two elements, like usort($arr,cmp).
A reader-annotation in the manual points out that the user function cmp()
cannot be a member of a class and this seems to be consistent with my
experiments, but it is somewhat ugly. Does anyone know if there is a
workaround for this? Is it possible to use a comparison function that is
anything other than a global function? Specifically, I want to use
this->cmp().