Merge sort implementation - very PHP-ey