2011-12-11 07:33:46
0
Here is my array, let's call it $arr
Array ( [0] => Array ( [post] => 159 [city] => Denver [country] => [state] => Colorado)
[1] => Array ( [post] => 165 [city] => Miami [country] => United States [state] => Florida )
[2] => Array ( [post] => 172 [city] => East Rutherford [country] => United States [state] => New Jersey ) )
I would like to sort this array by the key "city" in ascending order so the array will be:
Array ( [0] => Array ( [post] => 159 [city] => Denver [country] => [state] => Colorado)
[2] => Array ( [post] => 172 [city] => East Rutherford [country] => United States [state] => New Jersey )
[1] => Array ( [post] => 165 [city] => Miami [country] => United States [state] => Florida ) )
I then want to also sort the array by the state key values in ascending order so it will look like this:
Array ( [0] => Array ( [post] => 159 [city] => Denver [country] => [state] => Colorado)
[1] => Array ( [post] => 165 [city] => Miami [country] => United States [state] => Florida
[2] => Array ( [post] => 172 [city] => East Rutherford [country] => United States [state] => New Jersey ) )