Array sort question
| From: | PHP | Date: | Tue, 28 Feb 2006 18:49:46 +0000 |
| Subject: | Array sort question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-231221@lists.php.net to get a copy of this message | ||
Hi,
How can I sort a 2 dimensional array by number of elements?
Ex:
rgArray[0] = ("1","2");
rgArray[1] = ("1");
rgArray[2] = ("1","2","3","4");
rgArray[3] = ("1","2","3");
Now I would like to sort it so I can loop through them from least elements to most (or vice versa):
rgArray[1] (now rgArray[0]) 1
rgArray[0] (now rgArray[1]) 1,2
rgArray[3] (now rgArray[2]) 1,2,3
rgArray[2] (now rgArray[3]) 1,2,3,4
Thanks.