相关疑难解决方法(0)

Reference — What does this symbol mean in PHP?

What is this?

This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.

Why is this?

It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …

php arguments symbols operators

4314
推荐指数
21
解决办法
63万
查看次数

PHP使用子数组值按字母顺序排序数组

可能重复:
如何在PHP中对数组和数据进行排序?
如何在
PHP中排序多维数组PHP排序数组按SubArray值PHP 按值
排序多维数组

我的数组看起来像:

Array(
    [0] => Array(
         [name] => Bill
         [age] => 15
    ),
    [1] => Array(
         [name] => Nina
         [age] => 21
    ),
    [2] => Array(
         [name] => Peter
         [age] => 17
    )
);
Run Code Online (Sandbox Code Playgroud)

我想根据他们的名字按字母顺序对它们进行排序.我看到PHP排序数组按SubArray值,但它没有多大帮助.任何想法如何做到这一点?

php arrays

62
推荐指数
2
解决办法
6万
查看次数

按php数组排序

我需要按照getNotifications函数中值'start_date'的DESC顺序对通知数组进行排序:

$posts_id_arr = getPoststIds($conn);

foreach ($posts_id_arr as $key => $val) {
  $total_arr[$key] = [
    'notification' => getNotifications($val['post_id'], $user_id, $conn)
  ];
}

$response_array = array('data' => $total_arr, 'more things' => $more_array);
echo json_encode($response_array);
Run Code Online (Sandbox Code Playgroud)

现在,由于foreach循环,订单是通过邮递ID进行的。

data {
       notification: 
      [
       {
        post_id: “1",
        start_date: "2016-10-10 08:00:00",
       },
       {
        post_id: “1",
        start_date: "2016-10-10 12:00:00",
       }
    ],
     notification:
      [
        post_id: “2",
        start_date: "2016-10-10 09:00:00",
       },
       {
        post_id: “2",
        start_date: "2016-10-10 13:00:00",
       }
    ]
}
Run Code Online (Sandbox Code Playgroud)

我需要是1:08:00,2:09:00,1:12:00,2:13:00

php sorting date

5
推荐指数
1
解决办法
82
查看次数

标签 统计

php ×3

arguments ×1

arrays ×1

date ×1

operators ×1

sorting ×1

symbols ×1