3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ordinalHolidays = [ 'thanksgiving' => 'fourth Thursday of November', 'blackfriday' => 'fourth Thursday of November + 1 day' ]; $startDate = new \DateTimeImmutable('2016-04-20'); $periods = new \DatePeriod($startDate, new \DateInterval('P1Y'), 5); foreach ($periods as $date) { echo 'Holidays for ' . $date->format('Y') . \PHP_EOL; foreach ($ordinalHolidays as $holiday => $ordinalHoliday) { $holidayDate = $date->modify($ordinalHoliday); echo $holiday . ' is ' . $holidayDate->format('Y-m-d') . \PHP_EOL; } echo \PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Holidays for 2016 thanksgiving is 2016-11-24 blackfriday is 2016-11-25 Holidays for 2017 thanksgiving is 2017-11-23 blackfriday is 2017-11-24 Holidays for 2018 thanksgiving is 2018-11-22 blackfriday is 2018-11-23 Holidays for 2019 thanksgiving is 2019-11-28 blackfriday is 2019-11-29 Holidays for 2020 thanksgiving is 2020-11-26 blackfriday is 2020-11-27 Holidays for 2021 thanksgiving is 2021-11-25 blackfriday is 2021-11-26

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
101.7 ms | 1525 KiB | 4 Q