Advent of code 2016/15
Ajax Direct

Answer

Part 1 :
Part 2 :
function solve($discs) {
    for ($i = 0;;$i++) {
        foreach ($discs as $disc) if (Math::mod($disc[0] + $i, $disc[1])) continue 2;
        return $i;
    }
}

$discs = $input->lines->map(function ($line) {
    $nums = $line->numbers();
    return [Math::mod($nums[3] + $nums[0], $nums[1]), $nums[1]];
});

// ==================================================
// > SOLUTIONS
// ==================================================
$solution_1 = solve($discs);

$discs[] = [Math::mod(0 + count($discs) + 1, 11), 11];
$solution_2 = solve($discs);