时间:2021-07-01 10:21:17 帮助过:4人阅读
//先变形为这样,即用 uid 做键。生成这些数据时就应该这样做好Array
$old_rank = array(
132=>array('uid'=>132,'use_score'=>61570),
121=>array('uid'=>121,'use_score'=>50932),
145=>array('uid'=>145,'use_score'=>46789),
100=>array('uid'=>100,'use_score'=>39089),
167=>array('uid'=>167,'use_score'=>29089)
);
$new_rank = array(
132=>array('uid'=>132,'use_score'=>61570),
145=>array('uid'=>145,'use_score'=>51932),
121=>array('uid'=>121,'use_score'=>50932),
167=>array('uid'=>167,'use_score'=>40089),
100=>array('uid'=>100,'use_score'=>39089)
);
foreach($new_rank as $k=>$v)
$res[$k] = $v['use_score'] - $old_rank[$k]['use_score'];
print_r($res);