compare($list[$i + 1], $order)) { $old = $list[$i]; $list[$i] = $list[$i + 1]; $list[$i + 1] = $old; $sorted = false; } } for ($i = 0; $i < $n - 1; $i += 2) { if ($list[$i]->compare($list[$i + 1], $order)) { $old = $list[$i]; $list[$i] = $list[$i + 1]; $list[$i + 1] = $old; $sorted = false; } } } return $list; } }