#22006 [Com]: Multidimensional Array sorting

From: Date: Sun, 02 Feb 2003 05:48:24 +0000
Subject: #22006 [Com]: Multidimensional Array sorting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31868@lists.php.net to get a copy of this message
ID: 22006 Comment by: php@richardneill.org Reported By: php@richardneill.org Status: Open Bug Type: Feature/Change Request Operating System: Linux PHP Version: 4.2.0 New Comment: Oops - that doesn't quite make sense. We want to be able to sort on "the 3rd column" or "the 7th row" if it's 2-D; in the case of 3-D, we need to be able to sort on "(the line determined by depth=4 and height=3)". So a better prototype would be: my_array_sort(my_array,i,j,-,l) meaning: sort by index k, where the other indices have values of i,j,l respectively) [Array multisort will work, but only to sort by column; therefore if one wants to sort by ROW, the array must be redesigned]. Sorry the first comment isn't mathematically sensible! Previous Comments: ------------------------------------------------------------------------ [2003-02-01 23:24:16] php@richardneill.org Consider an array of arrays : myarray["$i"]["$j"]...["$n"] I'd like to see a function which will allow me to sort this on the nth array index. Something like: my_array_function(myarray, n) where n is the dimension to sort on. This would make it easy to sort any array by row, column, depth, etc Sorry if this feature already exists - I have spend 2 hours reading the manual and googling for it to no avail. I know there are ways to get around it, but a dedicated function would be nice. Thanks. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22006&edit=1

« previous php.bugs (#31868) next »