advent_of_code_2024/day_3/part_1.php

9 lines
218 B
PHP
Raw Normal View History

<?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;