advent_of_code_2024/day_3/part_1.php
Clement Desmidt 77cfb5eba7 Finit les part 1 du jour 2 et 3
Ouin, pas le temps de faire les part 2 😭
2024-12-03 11:20:03 +01:00

9 lines
218 B
PHP

<?php
$instruction = file_get_contents(__DIR__.'/input.txt');
preg_match_all('/mul\((\d+),(\d+)\)/', $instruction, $muls, PREG_SET_ORDER);
echo array_sum(array_map(static fn($mul) => $mul[1]*$mul[2], $muls));
exit;