PHP 里面的数组按照某个时间字段排序
2021-04-10 14:26
标签:time store name dfa multisort als multi jpg 原则 代码如下: 需要按照数组中的时间进行升序排列。 PHP 里面的数组按照某个时间字段排序 标签:time store name dfa multisort als multi jpg 原则 原文地址:https://www.cnblogs.com/stronger-xsw/p/13367624.html$store_list = Array
(
[0] => Array
(
[name] => asdf
[head] => /upload/thumbs/20150814220142_27630.jpg
[img] =>
[content] => asdfasdfasdf
[datetime] => 2015-10-11 09:55:08
[flag] => false
)
[1] => Array
(
[name] => 基本原则顶替
[head] =>
[img] =>
[content] => 基本原则顶替
[datetime] => 2015-09-01 10:41:08
[flag] => true
)
[2] => Array
(
[name] => ad
[head] => /upload/thumbs/20150814220142_27630.jpg
[img] =>
[content] => asdfasdf
[datetime] => 2015-09-01 09:51:08
[flag] => false
)
)
foreach($sort_list as $key=>$v){
$sort_list[$key][‘datetime‘] = date("YmdHis",strtotime($v[‘datetime‘]));
}
$datetime = array();
foreach ($sort_list as $user) {
$datetime[] = $user[‘datetime‘];
}
array_multisort($datetime,SORT_DESC,$sort_list);
print_r()
原文链接:https://blog.csdn.net/u012015434/article/details/48153847
上一篇:Java方法
文章标题:PHP 里面的数组按照某个时间字段排序
文章链接:http://soscw.com/index.php/essay/73822.html