advent_of_code_2020/day_4/part_1.php

13 lines
321 B
PHP
Raw Permalink Normal View History

2020-12-04 12:13:43 +01:00
<?php
include 'passport.php';
$passports = explode("\n\n", file_get_contents('input.txt'));
$number_of_valid_passports = 0;
foreach ($passports as $passport) {
$passport_o = Passport::fromInput($passport);
$number_of_valid_passports += ($passport_o->isValid()) ? 1 : 0;
}
var_dump($number_of_valid_passports);