Edit report at http://bugs.php.net/bug.php?id=28833&edit=1

 ID:                 28833
 Updated by:         [email protected]
 Reported by:        xuefer at 21cn dot com
 Summary:            make array_multisort more easy to use
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   all
 PHP Version:        4.3.7
 Block user comment: N
 Private report:     N

 New Comment:

It's fine as it is.


Previous Comments:
------------------------------------------------------------------------
[2004-06-18 18:11:35] xuefer at 21cn dot com

Description:
------------
$ar = array(array("10", 100, 100, "a"), array(1, 3, "2", 1)); 



we now must do:

array_multisort($ar[0], SORT_ASC, SORT_STRING, 

               $ar[1], SORT_NUMERIC, SORT_DESC); 



1.

========



how about:

array_multisort($ar, "0", SORT_ASC, SORT_STRING, 

               "1", SORT_NUMERIC, SORT_DESC); 



but "int" type of key may mixed with sort flags :(



nicer example:

$ar = array('abc' => array("10", 100, 100, "a"), 'def' => array(1, 3,
"2", 1)); 

array_multisort($ar, "abc", SORT_ASC, SORT_STRING, 

               "def", SORT_NUMERIC, SORT_DESC); 



this is VERY useful when you have so many arrays in $ar, but only want
to sort BY some of it



2.

========

because "SHOW PROCESSLIST" cannot do a "ORDER BY"

we need:

/*

$rows = array();

while ($row = mysqli_fetch_assoc()) {

  $rows[] = $row;

}

*/

$rows = array(

  array('a' => "10", 'b' => 100, 'c' => 100, 'd' => "a"),

  array('a' => 1, 'a' => 3, 'a' => "2", 'd' => 1)

); 

array_multisort_rows($row, "a", SORT_ASC, SORT_STRING, 

               "b", SORT_NUMERIC, SORT_DESC); 





------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=28833&edit=1

Reply via email to