我有以下数组,我想根据“lastfirma”值进行排序。所以下面的数组:
Array
(
[000002] => Array
(
[clients] => Array
(
[556046-2222] => Array
(
[lastfirma] => Name 1
[periods] => Array
(
[1] => Array
(
[userId] => 000015
[start] => 2020-05-01
[end] => 2021-04-30
)
[2] => Array
(
[userId] => 105779
[start] => 2021-05-01
[end] => 2022-04-30
)
)
)
[556892-1111] => Array
(
[lastfirma] => Anomaly
[periods] => Array
(
[1] => Array
(
[userId] => 000015
[start] => 2020-05-01
[end] => 2021-04-30
)
[2] => Array
(
[userId] => 105779
[start] => 2021-05-01
[end] => 2022-04-30
)
)
)
)
)
)
会变成
Array
(
[000002] => Array
(
[clients] => Array
(
[556892-1111] => Array
(
[lastfirma] => Anomaly
[periods] => Array
(
[1] => Array
(
[userId] => 000015
[start] => 2020-05-01
[end] => 2021-04-30
)
[2] => Array
(
[userId] => 105779
[start] => 2021-05-01
[end] => 2022-04-30
)
)
)
[556046-2222] => Array
(
[lastfirma] => Name 1
[periods] => Array
(
[1] => Array
(
[userId] => 000015
[start] => 2020-05-01
[end] => 2021-04-30
)
[2] => Array
(
[userId] => 105779
[start] => 2021-05-01
[end] => 2022-04-30
)
)
)
)
)
)
krsort($input['000002']['clients']);