[英]php: alphabetically sort multi-dimensional array by its key?
我需要按其鍵的字母順序對一些嵌套數組進行排序...
是否有本機PHP函數可以對以下內容進行排序,以便嵌套數組像
[G]->數組...
[I]->數組...
[P]->數組...
[S]->數組...
[T]->數組...
這是一個未排序數組的示例:
[S] => Array
(
[26] => Array
(
[name] => St Georges Hall
[tel] => sdfa
)
[27] => Array
(
[name] => St Werburghs Community Centre
[tel] => sadf
)
)
[G] => Array
(
[40] => Array
(
[name] => The Golden Guinea
[tel] =>
)
[41] => Array
(
[name] => The Golden Lion
[tel] => One of Bristol's key live music pubs
)
)
[I] => Array
(
[45] => Array
(
[name] => The Island
[tel] => asdfgf
)
)
[P] => Array
(
[50] => Array
(
[name] => The Prom
[tel] => Reliable gig venue and blues hotspot on Gloucester road
)
)
[T] => Array
(
[51] => Array
(
[name] => The Thunderbolt
[tel] => Small gig venue in Totterdown
)
[52] => Array
(
[name] => Tobacco Factory
[tel] => A modern cafe-bar with regular live music.
)
)
是的, ksort
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.