Advent of code 2022/3
Ajax Direct

Answer 12ms

Part 1 : 7826 Part 2 : 2577
function priority($item)
{
    return ord($item) - ($item <= "Z" ? (64 - 26) : 96);
}

// ==================================================
// > PART 1
// ==================================================
$solution_1 = $input->lines->map(fn ($line) =>
    $line->sub(0, $line->length / 2)->chars
    ->keep($line->sub($line->length / 2)->chars)
    ->unique()->first()
)->map("priority")->sum();

// ==================================================
// > PART 2
// ==================================================
$solution_2 = $input->lines->chunk(3)->map(fn ($group) =>
    $group->map(fn ($line) => $line->chars->unique())->merge()->duplicates(3)[0]
)->map("priority")->sum();