多维数组排序
如下
PHPコード
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><?php
[code=PHP]$arr = Array
(
['page'] => 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
)
)
)
);
ログイン後にコピー
想变成
$arr = Array
(
['ページ'] => 1
['合計'] => 2274
['行'] => 配列
(
[0] => 配列
🎜> ['id'] => 12
['cell'] => 配列
(
['fid'] => 12
['number'] => 2
)
)
[1] => 配列
(
['id'] => 13
['cell'] = > 配列
(
['fid'] => 13
['number'] => 3
)
)
[2 ] => 配列
(
['id'] => 14
['cell'] => 配列
(
['fid'] => 14
['number'] => 4
)
)
[3] => 配列
(
['id'] => 15
['セル'] => 配列
(
['fid'] => 15
['数値'] => 5
)
)
[4] => 配列
(
['id'] => 16
['cell'] => 配列
(
['fid'] => 16
['number'] => 10
)
)
);[/code ]
不知大家有没有好的做法
-----解决方案-------- -
何だ?按照番号は小さいから大きい?
------解决方案---------
建议你格式化後贴出来,记得贴var_export($arr); このような結果が得られた。
-----解解案案---------
usort
------解解案---------
原始データ
1 => array ( 'id' => 13, 'cell' => array ( 'fid' => 13, 'number' => 5, ), )怎么变成了
1 => ; array ( 'id' => 13, 'cell' => array ( 'fid' => 13, 'number' => 3, ), )