Array
(
["News 1"] => Array
(
[text] => tests
[language] =>
[advertiserCompetitionScale] => 5
[avgSearchVolume] => 7480000
[lastMonthSearchVolume] => 9140000
)
["News 2"] => Array
(
[text] => personality tests
[language] =>
[advertiserCompetitionScale] => 5
[avgSearchVolume] => 165000
[lastMonthSearchVolume] => 201000
)
["News 3] => Array
(
[text] => online tests
[language] =>
[advertiserCompetitionScale] => 5
[avgSearchVolume] => 246000
[lastMonthSearchVolume] => 301000
)
)
같은 연관 배열 내가 원하는 열 (LastMonthSearchVolume 예)하여 제압가
// compare function
function cmpi($a, $b)
{
return strcmp($a["lastMonthSearchVolume"], $b["lastMonthSearchVolume"]);
}
// do the array sorting
usort($latest_array, 'cmpi');
문제는 때이다 배열을 덤프하여 결과를 봅니다. usort가 "News 1", "News 2"등을 제거하여 연관 배열을 깨고 0,1,2로 바꾸십시오.
정렬 할 수있는 솔루션이 있습니까? 칼럼을 지키다 이름?
감사 usort
대신에