Created
December 6, 2020 13:55
-
-
Save santarinto/0eb1e7b4a458948f5201055651cf5f50 to your computer and use it in GitHub Desktop.
average ideal ferrary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$date = new DateTime('0001-01-01'); | |
$now = new DateTime('2022-01-01'); | |
$count = 0; | |
while ($date < $now) { | |
$isSuitable = false; | |
if ((int)$date->format('m') === 2) { | |
$d1 = clone $date; | |
$d1->add(new DateInterval('P28D')); | |
if ((int)$d1->format('m') > 2) { | |
if ($date->format('D') === 'Mon') { | |
$isSuitable = true; | |
} | |
} | |
} | |
if ($isSuitable) { | |
echo ++$count . ': ' . $date->format('d-m-Y') . PHP_EOL; | |
} | |
$date->add(new DateInterval('P1M')); | |
} | |
echo 'Total: ' . $count . ' cases, average: ' . (2021 / $count) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment