From: xuefer at 21cn dot com
Operating system: all
PHP version: 4.3.7
PHP Bug Type: Feature/Change Request
Bug description: make array_multisort more easy to use
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 bug report at http://bugs.php.net/?id=28833&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28833&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28833&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28833&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28833&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28833&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28833&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28833&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28833&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28833&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28833&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28833&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28833&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28833&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28833&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28833&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28833&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28833&r=float