我有这个数组数组,
Array
(
[0] => Array
(
[id] => 1
[title] => AP-2 (1)
)
[1] => Array
(
[id] => 2
[title] => AC-1 (2)
)
[2] => Array
(
[id] => 3
[title] => AB-3 (1)
)
[3] => Array
(
[id] => 4
[title] => AD-2 (3)
)
[4] => Array
(
[id] => 5
[title] => AE-2 (1)
)
),
我需要以一种看起来像这样的方式对其进行排序,
Array
(
[0] => Array
(
[id] => 1
[title] => AB-3 (1)
)
[1] => Array
(
[id] => 2
[title] => AC-1 (2)
)
[2] => Array
(
[id] => 3
[title] => AD-2 (3)
)
[3] => Array
(
[id] => 4
[title] => AE-2 (1)
)
[4] => Array
(
[id] => 5
[title] => AP-2 (1)
)
)
这里发生的基本上是,使用title
键按字母顺序对数组进行排序,或者使用natsort()
or对其进行排序natcasesort()
。我将如何实际进行排序?提前致谢。