I have an array that looks something like this:
Array
(
[0] => Array
(
[id] => 4
[date] => 15.12.2014
[archived] => 0
)
[1] => Array
(
[id] => 3
[date] => 19.12.2014
[archived] => 0
)
[2] => Array
(
[id] => 6
[date] => 15.11.2014
[archived] => 0
)
)
What I would like to do is sort the items into high-to-low order in the first dimension based on the date value in the second dimension. I can use strtotime() on the [date] field and produce a unix timestamp (please note, these dates are in Australian format and not US. The server produces the correct timestamp).
I'm aware that I can use arsort() to arrange this array, but I'm not sure how to do it based on the value of a second dimension array key.
I need the array to look like this:
Array
(
[0] => Array
(
[id] => 3
[date] => 19.12.2014
[archived] => 0
)
[1] => Array
(
[id] => 4
[date] => 15.12.2014
[archived] => 0
)
[2] => Array
(
[id] => 6
[date] => 15.11.2014
[archived] => 0
)
)
How can I best achieve this in PHP?
I've tried various arrangements of the following to no avail:
arsort($items, strtotime(['date']))