User Tools

Site Tools


uphp:library_functions:quick_sort

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:library_functions:quick_sort [2021/12/27 08:42]
admin
uphp:library_functions:quick_sort [2021/12/27 08:50] (current)
admin
Line 34: Line 34:
  
 <html><b><span style="color:blue">$method<span style="color:black"></b></html>: One of the following methods: <html><b><span style="color:blue">$method<span style="color:black"></b></html>: One of the following methods:
-<html>               + 
 ^TYPE^VALUE^DESCRIPTION^ ^TYPE^VALUE^DESCRIPTION^
 | SORT_KEY   | 0     | Sort an array by the key                  | | SORT_KEY   | 0     | Sort an array by the key                  |
 | SORT_VALUE | 1     | Sort an array by the value                | | SORT_VALUE | 1     | Sort an array by the value                |
-| SORT_FUNC  | 2     | Sort an array using a callback function   |+| SORT_FUNC  | 2     | Sort an array using a callback function * only in OS4+  | 
 + 
 +<html><b><span style="color:blue">$callback<span style="color:black"></b></html>: optional string containing function name for callback of the method is SORT_FUNC.  The function needs to have 2 parameters, which will be the array elements.  These need to be compared and if the first array is less than the second array, the function should return 1, otherwise it should return 0.  See the example below.
  
 ====Return Values==== ====Return Values====
Line 51: Line 54:
 <pre><?  <pre><? 
    
 +include("/lib/uphp/array.inc");
 +
 $unsorted = array(); $unsorted = array();
 for ($i=0;$i<10;$i++) { for ($i=0;$i<10;$i++) {
uphp/library_functions/quick_sort.1640594553.txt.gz · Last modified: 2021/12/27 08:42 by admin