标签:
$a = array(1,5,12,16); $b = array(2,3,15,19,25); $c = array(); $ak = $bk = 0; $countA = count($a); $countB = count($b); $countAB = $countA + $countB; for($i=0; $i<$countAB; $i++) { if($ak<$countA && $bk<$countB) { if($a[$ak] < $b[$bk] ) { $c[$i] = $a[$ak]; unset($a[$ak]); $ak++; } else { $c[$i] = $b[$bk]; unset($b[$bk]); $bk++; } } } $end = $a ? $a : $b; foreach($end as $v) { array_push($c, $v); } echo ‘<pre>‘;print_r($c);die;
标签:
原文地址:http://www.cnblogs.com/wtb123456/p/4211057.html