sorting doesn't sort?
From: Håvard Olerud Eriksen (hereriks_at_PANTSyahoo.com)
Date: 06/30/04
- Next message: Perttu Pulkkinen: "Re: Help-news updater"
- Previous message: James Smith: "Re: HTML: Table Borders"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 13:02:38 +0200
I've got an array of arrays that I need to sort on preferably one of the
indices of the nested array, keeping the order of the outside array. The
structure is like this:
array([i] => array(key["name"] => data)
and what I need to do is to sort the nested array alphabetically according
to key["name"].
I can either use the name property of the nested array as index for the
outside array (then I need to keep the relationship between the outside
array and the nested array, or use a numeric index thus making the
relationship between the outside and nested array irrellevant.) What I need
to do in any case is to sort the nested array. I've tried using
arsort($array, SORT_STRING) but for some reason this doesn't sort the array
the way that I expected.
Can anyone help me out?
A var_dump of one element of the outside array looks like this:
array(2)
{ [1]=> array(2)
{ ["id"]=> string(1) "1" ["name"]=> string(6) "JustforShow" }
{ [2]=> array(2)
{ ["id"]=> string(1) "1" ["name"]=> string(6) "Testing" }
etc.
- Next message: Perttu Pulkkinen: "Re: Help-news updater"
- Previous message: James Smith: "Re: HTML: Table Borders"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|