3v4l.org

run code in 300+ PHP versions simultaneously
<?php print_r(getFirstDayInMonth(new DateTime())); function getFirstDayInMonth($date) { $firstDayInMonth = $date->modify("first day of this month"); if($firstDayInMonth->format("Y-m-d") == date("Y-m-d", easter_date($firstDayInMonth->format($firstDayInMonth->format("Y"))))) $firstDayInMonth->modify("+2 days"); // posunutí z neděle na úterý if($firstDayInMonth->format($firstDayInMonth->format("Y")) == 2024) $firstDayInMonth->modify("+1 day"); // 1. leden if($firstDayInMonth == new DateTime("1.1.".$firstDayInMonth->format("Y"))) $firstDayInMonth->modify("+1 day"); // 1. květen print_r($firstDayInMonth); print_r(new DateTime($firstDayInMonth->format("Y") . "-05-01")); if($firstDayInMonth == new DateTime($firstDayInMonth->format("Y") . "-05-01")) $firstDayInMonth->modify("+1 day"); // zjištění dnu v týdnu $numberOfDay = $firstDayInMonth->format("w"); //sobota if($numberOfDay == 6) $firstDayInMonth = $firstDayInMonth->modify("+2 days"); // neděle if($numberOfDay == 0) // ne $firstDayInMonth = $firstDayInMonth->modify("+1 day"); return $firstDayInMonth; }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function easter_date() in /in/dYgTE:9 Stack trace: #0 /in/dYgTE(3): getFirstDayInMonth(Object(DateTime)) #1 {main} thrown in /in/dYgTE on line 9
Process exited with code 255.

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