0) && (count($right) > 0)) { if ($left[0] <= $right[0]) { $result[] = $left[0]; array_shift($left); } else { $result[] = $right[0]; array_shift($right); } } if (count($left) > 0) { foreach ($left as $item) { $result[] = $item; } } if (count($right) > 0) { foreach ($right as $item) { $result[] = $item; } } print "---[result: start]---\n"; print_r($result); print "---[result: end]---\n"; return $result; } ?>