Solution to the first puzzle of Advent of Code 2021. pog

This commit is contained in:
kplaczek
2021-12-01 20:44:22 +01:00
parent 33b8b40b64
commit ade4d019b9
3 changed files with 2026 additions and 0 deletions

17
01/index.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
/**
*
*/
$increased = 0;
$inputStream = fopen('input', 'r');
$previousReading = (int)fgets($inputStream);
while (($line = fgets($inputStream)) !== false) {
$line = (int)$line;
if ($line > $previousReading) {
$increased++;
}
$previousReading = $line;
}
fclose($inputStream);
echo $increased; //1553