虽然这篇文章有很多类似的主题,但是在这个论坛和网上都没有重复,或者可能有,但我找不到它。
我需要的是按KEY的字母顺序对此数组进行排序。问题是,所有的KEY都是动态的,因此需要依赖STATIC。
除了其他帖子,我还查看了PHPs排序函数,如multisort,ksor等。
错误地列出: 在学术,[学生]和[工作人员] 在MARKETING [应用]和[活动]
下提前致谢
ARRAY
Array
(
[ACADEMIC] => Array
(
[Communications] => Array
(
[Email] => academic/email
[Sms] => academic/sms
)
[Exams] => Array
(
[Assessments] => academic/assessments
)
[Students] => Array
(
[Progress] => academic/progress
)
[Staff] => academic/staff
)
[ACCOUNTS] => Array
(
[Order] => accounts/order
)
[ADMIN] => Array
(
[Menus] => admin/menus
[Permissions] => admin/permissions
[Roles] => admin/roles
[Users] => admin/users
)
[AGENTS] => Array
(
[New] => agents/new
)
[MARKETING] => Array
(
[Applications] => Array
(
[Edit] => marketing/edit
[New] => marketing/new
)
[Activity] => marketing/activity
)
)
答案 0 :(得分:0)
找到方法:
foreach ($array as $key => $inner)
{
ksort($array[$key]);
}