<?php
//按C的大小重新排列数组
$arr = array(
array('a'=>33,'b'=>32,'c'=>12),
array('a'=>33,'b'=>32,'c'=>13),
array('a'=>33,'b'=>32,'c'=>11)
);
------解决方案--------------------
- PHP code
$arr = array( array('a'=>33,'b'=>32,'c'=>12), array('a'=>33,'b'=>32,'c'=>13), array('a'=>33,'b'=>32,'c'=>11) ); usort($arr, 'sortByC'); function sortByC($a, $b) { return $a['c'] - $b['c']; } echo '<pre>'; print_r($arr);
------解决方案--------------------
- PHP code
foreach($arr as $v) $t[]=$v['c']; array_multisort($t,$arr); print_r($arr);