sorting multi-dimensional array where array elements are structs [simple class]
| From: | Erin Fry | Date: | Mon, 10 Feb 2003 22:23:10 +0000 |
| Subject: | sorting multi-dimensional array where array elements are structs [simple class] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135126@lists.php.net to get a copy of this message | ||
Hi.
I’m working with a multidimensional array where the data in the array is a class (struct). All
the information is being stored correctly, but I need to sort each “column” (AA0, BA0, etc. –
see below) by the fieldNo portion of the struct.
class fieldClass
{
var $fieldNo;
var $srcLineNo;
var $data;
}
AA0 BA0 BA1 …
__________________
0 |____|_____|_____|___
1 |____|_____|_____|___
2 |____|_____|_____|___
3 |____|_____|_____|___
4 |____|_____|_____|___
. |____|_____|_____|___
. |____|_____|_____|___
. | | | |
I can find tons of examples and the such for regular multidimensional arrays with one data element
(not a struct), and I’ve tried several sort function in php but they didn’t work (although I
could have just been trying the wrong thing).
If anyone has done this before or has any suggestions, I would greatly appreciate it.
Erin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.449 / Virus Database: 251 - Release Date: 1/27/2003