PHP 里面的数组按照某个时间字段排序


	PHP 里面的数组按照某个时间字段排序
[编程语言教程]

代码如下:

$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

PHP 里面的数组按照某个时间字段排序

原文地址:https://www.cnblogs.com/stronger-xsw/p/13367624.html

hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » PHP 里面的数组按照某个时间字段排序