如何使用PHP对数组元素进行排序

时间:2019-06-13 16:52:56

标签: php

如何在PHP中对以下数组进行排序

Array
(
    [server1] => Array
        (
            [hid] => A201
            [rack] => A1
            [hname] => server1
            [error] => 45
        )

    [server2] => Array
        (
            [hid] => A110
            [rack] => A2
            [hname] => server2
            [error] => 43
        )

    [server3] => Array
        (
            [[hid] => A301
            [rack] => A3
            [hname] => server3
            [error] => 57
        )

需要的输出:

[server3] => Array
        (
            [[hid] => A301
            [rack] => A3
            [hname] => server3
            [error] => 57
         )

[server1] => Array
        (
            [hid] => A201
            [rack] => A1
            [hname] => server1
            [error] => 45
        )

[server2] => Array
        (
            [hid] => A110
            [rack] => A2
            [hname] => server2
            [error] => 43
        )

0 个答案:

没有答案