複雑な多次元配列があります。構造はこんな感じ
Array
(
[0] => Array
(
[countries] => Array
(
[0] => Array
(
[country_code] => US
[growth] => 3.57
)
[1] => Array
(
[country_code] => CA
[growth] => 4.77
)
[2] => Array
(
[country_code] => TT
[growth] => 0
)
)
[group_name] => North America
)
[1] => Array
(
[countries] => Array
(
[0] => Array
(
[country_code] => BR
[growth] => 2.19
)
[1] => Array
(
[country_code] => PE
[growth] => 1.78
)
[2] => Array
(
[country_code] => UY
[growth] => 8.83
)
[3] => Array
(
[country_code] => MX
[growth] => 3.83
)
)
[group_name] => South America
)
)
array_multisort
(を使用して)並べ替えて、growth
(最も高いものから)順に並べ替えたい
ソートされた配列が
Array
(
[0] => Array
(
[countries] => Array
(
[0] => Array
(
[country_code] => CA
[growth] => 4.77
)
[1] => Array
(
[country_code] => US
[growth] => 3.57
)
[2] => Array
(
[country_code] => TT
[growth] => 0
)
)
[group_name] => North America
)
[1] => Array
(
[countries] => Array
(
[0] => Array
(
[country_code] => UY
[growth] => 8.83
)
[1] => Array
(
[country_code] => MX
[growth] => 3.83
)
[2] => Array
(
[country_code] => BR
[growth] => 2.19
)
[3] => Array
(
[country_code] => PE
[growth] => 1.78
)
)
[group_name] => South America
)
)
私はPHPを初めて使用するため、この複雑な配列を並べ替える方法がわかりませんでした。http://in2.php.net/manual/en/function.array-multisort.phpに示すように、単純な多次元配列を並べ替える方法を知っています。