如下
php code 1 ['total'] => 2274 ['rows'] => array ( [0] => array ( ['id'] => 12 ['cell'] => array ( ['fid'] => 12 ['number'] => 3 ) ) [1] => array ( ['id'] => 13 ['cell'] => array ( ['fid'] => 13 ['number'] => 5 ) ) [2] => array ( ['id'] => 14 ['cell'] => array ( ['fid'] => 14 ['number'] => 2 ) ) [3] => array ( ['id'] => 15 ['cell'] => array ( ['fid'] => 15 ['number'] => 4 ) ) [4] => array ( ['id'] => 16 ['cell'] => array ( ['fid'] => 16 ['number'] => 10 ) ) ));
想变成
1
['total'] => 2274
['rows'] => array
(
[0] => array
(
['id'] => 12
['cell'] => array
(
['fid'] => 12
['number'] => 2
)
)
[1] => array
(
['id'] => 13
['cell'] => array
(
['fid'] => 13
['number'] => 3
)
)
[2] => array
(
['id'] => 14
['cell'] => array
(
['fid'] => 14
['number'] => 4
)
)
[3] => array
(
['id'] => 15
['cell'] => array
(
['fid'] => 15
['number'] => 5
)
)
[4] => array
(
['id'] => 16
['cell'] => array
(
['fid'] => 16
['number'] => 10
)
)
)
);[/code]
不知大家有没有好的做法
------解决方案--------------------
什么规则?按照number从小到大?
------解决方案--------------------
建议你格式化后贴出来,记得贴 var_export($arr); 后的结果。这样太伤眼睛了。
------解决方案--------------------
usort
------解决方案--------------------
原始数据
1 => array ( 'id' => 13, 'cell' => array ( 'fid' => 13, 'number' => 5, ), )
怎么变成了
1 => array ( 'id' => 13, 'cell' => array ( 'fid' => 13, 'number' => 3, ), )
