我有一个像这样的多维数组:
array ([0] => array ([id] => 1 [name] => john doe [title] => Mr [days] => 10)
[1] => array ([id] => 2 [name] => Joe Smith [title] => Dr [days] => 22)
[2] => array ([id] => 3 [name] => John Jones [title] => Mr [days] => 3))
我需要对内部数组进行排序,以便按天键以自然顺序返回数据。
像这样的IE:
array ([2] => array ([id] => 3 [name] => John Jones [title] => Mr [days] => 3)
[0] => array ([id] => 1 [name] => john doe [title] => Mr [days] => 10)
[1] => array ([id] => 2 [name] => Joe Smith [title] => Dr [days] => 22))
我认为我需要的是一个通过 $key 将 natsort 应用于多维数组的函数,但到目前为止,我还没有找到除标准排序之外的任何函数。
有什么帮助吗?