【发布时间】:2017-08-01 16:32:21
【问题描述】:
我已经更新了我的问题,所以请检查一下。
我有一个如下数组:
$array = [
0 => [
"term" => "DECATHLON",
"count" => 7,
],
1 => [
"term" => "babywalz",
"count" => 6,
],
2 => [
"term" => "Douglas",
"count" => 3,
],
3 => [
"term" => "NETFLIX",
"count" => 2,
],
4 => [
"term" => "zalando",
"count" => 2,
],
5 => [
"term" => "Ernsting's family",
"count" => 1,
],
6 => [
"term" => "Spotify",
"count" => 1,
],
7 => [
"term" => "eventim",
"count" => 1,
]
];
我想像这样对数组进行排序:
$array = [
1 => [
"term" => "babywalz",
"count" => 6,
],
0 => [
"term" => "DECATHLON",
"count" => 7,
],
2 => [
"term" => "Douglas",
"count" => 3,
],
5 => [
"term" => "Ernsting's family",
"count" => 1,
],
7 => [
"term" => "eventim",
"count" => 1,
],
3 => [
"term" => "NETFLIX",
"count" => 2,
],
6 => [
"term" => "Spotify",
"count" => 1,
],
];
任何建议都会有所帮助。我使用了 asort(),但它没有按我的意愿工作。我也尝试过使用 natcasesort()。
【问题讨论】:
-
伴侣你在回答后完全重组了你的问题
标签: php