Advent of code 2022/6
Ajax Direct

Answer 366ms

Part 1 : 1655 Part 2 : 2665
function get_solution($input, $length)
{
    foreach ($input->chars as $pos=>$char)
        if ($input->chars->slice($pos, $length)->unique()->count() === $length)
            return $pos + $length;
}

// ==================================================
// > SOLUTIONS
// ==================================================
$solution_1 = get_solution($input, 4);
$solution_2 = get_solution($input, 14);