Advent of code 2018/1
Ajax Direct

Answer

Part 1 :
Part 2 :
// ==================================================
// > PART 1
// ==================================================
$solution_1 = $input->replace("\n", " ")->eval();

// ==================================================
// > PART 2
// ==================================================
$f  = 0;
$fs = [$f => true];

while (true) {
    foreach ($input->lines as $line) {
        $f += $line->eval();
        if (isset($fs[$f])) break 2;
        $fs[$f] = true;
    }
}
$solution_2 = $f;