All pastes #341202 Raw Edit

Unnamed

public php v1 · immutable
·published 2007-02-05 12:52 UTC
rendered paste body
function Merge($Left, $Right) {        $Result = array();        while(count($Left) > 0 && count($Right) > 1) {                if($Left[0] <= $Right[0]) {                        $Result[] = $Left[0];                        array_shift($Left);                } else {                        $Result[] = $Right[0];                        array_shift($Right);                }        }        if(count($Left) > 0) {                $Result[] = $Left[0];        }        if(count($Right) > 0) {                $Result[] = $Right[0];        }        return $Result;}