Part 2 :
$ranges = $input->lines->map(fn ($l) => array_map("intval", explode("-", $l)))->mergeRanges();
// ==================================================
// > PART 1
// ==================================================
$solution_1 = $ranges[0][1] + 1;
// ==================================================
// > PART 2
// ==================================================
$bound = -1;
$solution_2 = 0;
foreach ($ranges as $i => $range) {
$solution_2 += $range[0] - $bound - 1;
$bound = $range[1];
}