I ALWAYS forget this so I am posting it for myself and anyone else who stumbles upon it.
function subval_sort($a,$subkey) { foreach($a as $k=>$v) { $b[$k] = strtolower($v[$subkey]); } asort($b); foreach($b as $key=>$val) { $c[] = $a[$key]; } return $c; }
$songs = subval_sort($songs,'artist'); print_r($songs);
Array ( [0] => Array ( [artist] => Fleetwood Mac [song] => Second-hand News ) [1] => Array ( [artist] => The Decemberists [song] => The Island ) [2] => Array ( [artist] => The Smashing Pumpkins [song] => Cherub Rock ) )
Taken from this site:
http://www.firsttube.com/read/sorting-a-multi-dimensional-array-with-php/
Thanks!