note 64034 deleted from function.usort by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 16:21:07 +0000 |
| Subject: | note 64034 deleted from function.usort by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217829@lists.php.net to get a copy of this message | ||
Note Submitter: stephen in koto
----
For using usort inside a method in an object, where the callback sort method is in the same object,
this works:
<?php usort($arr_to_sort, array($this, "sort_terms_by_criteria")); ?>
If you wish to keep elements in their original or reverse order if they are the same length, just
don't return zero for items that compare the same. Return a 1 or -1, as appropriate.