Sorting a multidimensional array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Ixplodestuff8
Forum Commoner
Posts: 60
Joined: Mon Feb 09, 2004 8:17 pm
Location: Queens, New York

Sorting a multidimensional array

Post by Ixplodestuff8 »

I need help sorting a multidimensional arary.

Lets say I have this for example

Code: Select all

<?php

$array[$i]["foo"] = "bar";

$array[$i]["bar"] = "foo";

$i++;

$array[$i]["foo"] = "foo";


$array[$i]["bar"] = "bar";

?>
How could I order alphabetically, the values in the ["foo"] key ?

edit: I found out how to do it using usort, so problem solved.
Post Reply