Array Sorting, 2 items...
| From: | Dan Joseph | Date: | Tue, 22 Jul 2003 15:03:37 +0000 |
| Subject: | Array Sorting, 2 items... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-156236@lists.php.net to get a copy of this message | ||
Hi,
Trying to accomplish:
I want to sort my array by two columns. The array is setup:
Array
(
[0] => Array
(
[0] => CHECKING
[ba_type] => CHECKING
[1] => 10132200
[loan_number] => 10132200
[2] => 10000049
[loan_id] => 10000049
[3] => MONICA
[first_name] => MONICA
[4] => MERCHANT
[last_name] => MERCHANT
[5] => 2003-07-17 16:15:32
[approved_date] => 2003-07-17 16:15:32
[6] => ACH Debit
[type] => ACH Debit
)
[1] => Array
(
[0] => CHECKING
[ba_type] => CHECKING
[1] => 10154654
[loan_number] => 10154654
[2] => 10000055
[loan_id] => 10000055
[3] => RICH
[first_name] => RICH
[4] => LABO
[last_name] => LABO
[5] => 2003-07-17 16:15:32
[approved_date] => 2003-07-17 16:15:32
[6] => ACH Debit
[type] => ACH Debit
)
)
What I'd like to happen is first sort by ba_type, and then sort by
loan_number, so that I end up with a nice output similar to;
CHECKING 101234
CHECKING 101544
CHECKING 101573
SAVINGS 101112
SAVINGS 101224
VISA 101110
VISA 101998
Keep everything groupped together in their respective ba_type, and put the
numbers in numeric order. I've looked at usort, and many examples of it. I
can see how to use it to sort one column, but how would I sort a second to
achieve this?
-Dan Joseph