$n = 0;
        $result = array();
        while ($i < count($left) and $j < count($right)) {
            if ($left[$i] < $right[$j]) {
                $result[$n++] = $left[$i++];
            } else {
                $result[$n++] = $right[$j++];
            }
        }
        while ($i < count($left)) {
            $result[$n++] = $left[$i++];
        }
        while ($j < count($right)) {
            $result[$n++] = $right[$j++];
        }
        $this->array = $result;
        return $result;
    }
    /**
     * 获取排序后的结果
     * @return array
     */
    public function getResult()
    {
        return $this->array;
    }
}
$a = new Sort(array(1, 3, 8, 4, 2, 7, 8, 1));
$a->mergeSort();
print_r($a->getResult());
//print_r($a->mergeSort());