使用usort对数组进行排序-PHP源码
使用usort对数组进行排序
function cmp($a, $b) { if ($a['weight'] == $b['weight']) { return 0; } return ($a['weight'] < $b['weight']) ? 1 : -1; } usort($result,'cmp');
使用usort对数组进行排序
function cmp($a, $b) { if ($a['weight'] == $b['weight']) { return 0; } return ($a['weight'] < $b['weight']) ? 1 : -1; } usort($result,'cmp');
PHP之友评论