嗨,需要帮助首先从数组中获取值我已经从下面的数组中获取连续值 eg=>id:1,2 如果在获取值后连续值不退出,则忽略连续值的出价之间的差异,然后总结所有投标值(连续值)??
$bidperpage = array([0]=>array(['id']=>1,['bid']='10',['page']='5'),
[1]=>array(['id']=>2,['bid']='15',['page']='5'),
[2]=>array(['id']=>9,['bid']='20',['page']='2'),
[3]=>array(['id']=>3,['bid']='30',['page']='7'),
[4]=>array(['id']=>4,['bid']='40',['page']='7'),
[5]=>array(['id']=>5,['bid']='50',['page']='9'),
[6]=>array(['id']=>6,['bid']='60',['page']='4'),
[7]=>array(['id']=>8,['bid']='70',['page']='4'));
function checkconsecutivevalue($array) {
$ret = array();
$temp = array();
foreach($array as $val) {
if(next($array) == ($val + 1))
$temp[] = $val;
else
if(count($temp) > 0) {
$temp[] = $val;
$ret[] = $temp[0].':'.end($temp);
$temp = array();
}
else
$ret[] = $val;
}
return $ret;
}