3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime("first day of next month"); $publicHolidays = ['01-01', '05-01']; // Format: mm-dd while (true) { // format("N") >= 6 == Weekend if ($date->format("N") >= 6) { // If Saturday or Sunday, add 1 or 2 days. // N=6 (Saturday), 8-6 = 2, get monday // N=7 (Sunday), 8-7 = 1, get monday $date->modify("+".(8-$date->format("N"))." days"); } elseif (in_array($date->format("m-d"), $publicHolidays)) { // This day is a public holiday! Add one. $date->modify("+1 day"); } else { break; } } echo $date->format("Y-m-d");
Output for git.master, git.master_jit, rfc.property-hooks
2022-12-01

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:
25.75 ms | 405 KiB | 5 Q