I have an array similar to this
Array
(
[0] => Array
(
[showname] => White Collar
[air_time] => 1310590800
)
[1] => Array
(
[showname] => Chopped
[air_time] => 1310590800
)
[2] => Array
(
[showname] => Covert Affairs
[air_time] => 1310587200
)
} ... etc
I want to crete a new array that is sorted by air_time. for example all shows containing the same air_time should be in [0] then [1] then [2] etc..
An example of the output i would like is this:
Array
(
[0] => Array
(
[time] => 1310590800
[shows] => Array
(
[name] => White Collar
[name] => Chopped
)
)
[1] => Array
(
[time] => 1310587200
[shows] => Array
(
[name] => Covert Affairs
)
)
}
I've been looking at different array methods like multisort but i wasn't able to figure it out.
Could you point me in the right direction? thanks
update i know how to sort the array normally by time, i just dont know how can i separate and group elements that have the same time