我在数组中有一系列销售数据,我希望能够按第二维中的值对数组的第一维进行排序。我的代码按照数组的第一维的顺序打印销售数据,因此我需要做的就是更改维度的顺序以更改输出。
这是我的数组:
$salesdata = array
(
array
(
"1", //store number
"1580", //sales
"1151", //plan sales
"1441", //ly sales
"508", //sgp
"561", //plan sgp
"621", //ly sgp
"38", //tix
"-10", //tix var
),
array
(
"2", //store number
"1493", //sales
"1520", //plan sales
"2040", //ly sales
"610", //sgp
"1106", //plan sgp
"483", //ly sgp
"62", //tix
"0", //tix var
),
array
(
"3", //store number
"1987", //sales
"989", //plan sales
"1030", //ly sales
"997", //sgp
"482", //plan sgp
"554", //ly sgp
"63", //tix
"13", //tix var
),
)
我希望能够按任何值排序,但我可以解决这个问题。假设我想按销售额排序,我该怎么做?
谢谢!