Advent of code 2019/2
Ajax Direct

Answer

Part 1 :
Part 2 :
function get_output($memory, $noun, $verb)
{
    $memory[1] = $noun;
    $memory[2] = $verb;

    for ($i = 0; $i < $memory->count(); $i += 4) {
        [$opcode, $a, $b, $to] = $memory->slice($i, 4);

        if ($opcode == 99) {
            break;
        }

        if ($opcode == 1) {
            $memory[$to] = $memory[$a] + $memory[$b];
        }

        if ($opcode == 2) {
            $memory[$to] = $memory[$a] * $memory[$b];
        }
    }

    return $memory[0];
}

// ==================================================
// > PART 1
// ==================================================
$solution_1 = get_output($input->numbers(), 12, 2);

// ==================================================
// > PART 2
// ==================================================
for ($noun = 0; $noun < 100; $noun++) {
    for ($verb = 0; $verb < 100; $verb++) {
        if (get_output($input->numbers(), $noun, $verb) == 19690720) {
            break 2;
        }
    }
}
$solution_2 = 100 * $noun + $verb;