我有一个需要按第三级排序的数组。
我需要按fullname
值对数组进行排序。这可能吗?
$array = array(
'family1' => array(
'family_data' => array(
'fullname' => 'Samuel Smith',
'...' => '...'
)
),
'family2' => array(
'family_data' => array(
'fullname' => 'John Doe',
'...' => '...'
)
),
'family3' => array(
'family_data' => array(
'fullname' => 'Adrian Chan',
'...' => '...'
)
)
);
更容易阅读:
Array
(
[family1] => Array
(
[family_data] => Array
(
[fullname] => Samuel Smith
[...] => ...
)
)
[family2] => Array
(
[family_data] => Array
(
[fullname] => John Doe
[...] => ...
)
)
[family3] => Array
(
[family_data] => Array
(
[fullname] => Adrian Chan
[...] => ...
)
)
)
期望的结果是:
Array
(
[family3] => Array
(
[family_data] => Array
(
[fullname] => Adrian Chan
[...] => ...
)
)
[family2] => Array
(
[family_data] => Array
(
[fullname] => John Doe
[...] => ...
)
)
[family1] => Array
(
[family_data] => Array
(
[fullname] => Samuel Smith
[...] => ...
)
)
)