我已更新了我的问题,请查看。
我有一个如下的数组:
我希望将数组按照以下方式排序:
任何建议都将是有帮助的。我已经使用了asort(),但它并不像我想要的那样工作。我还尝试了natcasesort()。
我有一个如下的数组:
$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()。