如何按名称/时间戳排序多维数组?

Jav*_*ish 0 php arrays sorting

我使用了"rsort"功能,通过时间戳进行排序,当阵列仅包含时间戳和不多维的.

所以现在的问题是我如何处理这个问题?

该阵列看起来像similair

Array
(
    [0] => Array
        (
            [type] => post
            [id] => 1
            [timestamp] => 2017-08-12 21:03:22
            [poster] => 1
            [profile] => 1
            [post] => Testtttttinngggs
        )

    [1] => Array
        (
            [type] => post
            [id] => 2
            [timestamp] => 2017-08-12 21:03:18
            [poster] => 1
            [profile] => 5
            [post] => Hello you
        )

    [2] => Array
        (
            [type] => post
            [id] => 3
            [timestamp] => 2017-08-12 21:03:33
            [poster] => 1
            [profile] => 1
            [post] => Somesay timestamp is screwed
        )

    [3] => Array
        (
            [type] => post
            [id] => 4
            [timestamp] => 2017-08-12 21:28:54
            [poster] => 1
            [profile] => 1
            [post] => This is truely a teeest
        )

    [4] => Array
        (
            [type] => post
            [id] => 5
            [timestamp] => 2017-08-13 15:04:34
            [poster] => 1
            [profile] => 1
            [post] => Test test test test
        )

)
Run Code Online (Sandbox Code Playgroud)

Axa*_*lix 7

您可以使用array_multisort

array_multisort(array_column($list, 'timestamp'), SORT_ASC, $list);
Run Code Online (Sandbox Code Playgroud)