note 64034 added to function.usort
| From: | stepheninkoto at osu1 dot php dot net | Date: | Thu, 06 Apr 2006 05:28:53 +0000 |
| Subject: | note 64034 added to function.usort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107412@lists.php.net to get a copy of this message | ||
For using usort inside a method in an object, where the callback sort method is in the same object,
this works:
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.
----
Server IP: 210.138.109.182
Probable Submitter: 203.216.96.132
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.usort.php
Edit -- http://master.php.net/note/edit/64034
Del: integrated -- http://master.php.net/note/delete/64034/integrated
Del: useless -- http://master.php.net/note/delete/64034/useless
Del: bad code -- http://master.php.net/note/delete/64034/bad+code
Del: spam -- http://master.php.net/note/delete/64034/spam
Del: non-english -- http://master.php.net/note/delete/64034/non-english
Del: in docs -- http://master.php.net/note/delete/64034/in+docs
Del: other reasons-- http://master.php.net/note/delete/64034
Reject -- http://master.php.net/note/reject/64034
Search -- http://master.php.net/manage/user-notes.php