By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,870 Members | 1,654 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,870 IT Pros & Developers. It's quick & easy.

sorting doesn't sort?

P: n/a
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:
{ [1]=> array(2)
{ ["id"]=> string(1) "1" ["name"]=> string(6) "JustforShow" }
{ [2]=> array(2)
{ ["id"]=> string(1) "1" ["name"]=> string(6) "Testing" }

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.