嗨,我有一个数组,它是 2 个独立数组的组合,产生相同的结果,以下是合并后的数组:
Array
(
[0] => Array
(
[event_id] => 16
[user_id] => 3
[date_created] => 20130227095010
)
[1] => Array
(
[event_id] => 15
[user_id] => 2
[date_created] => 20130227101734
)
[2] => Array
(
[event_id] => 16
[user_id] => 2
[date_created] => 20130227094856
)
)
从这里开始,如何在不使用之前合并的 2 个数组的情况下根据 date_created desc 或 asc 再次排序?
更新:先前的数组结果
数组1:
Array
(
[0] => Array
(
[event_id] => 15
[user_id] => 2
[date_created] => 20130227101734
)
[1] => Array
(
[event_id] => 16
[user_id] => 2
[date_created] => 20130227094856
)
)
数组 2:
Array
(
[0] => Array
(
[event_id] => 16
[user_id] => 3
[date_created] => 20130227095010
)
)
我如何在这些函数中使用循环来为上述每个数组提取 date_created
usort($array,function($a, $b) { return $a['date_created'] - $b['date_created']; });