3v4l.org

run code in 300+ PHP versions simultaneously
<?php function scoutWeekly($n) { // today's date $today = new DateTime(); // set to first day of the month $today->setDate($today->format('Y'), $today->format('m'), 1); // get the Monday earlier $today->sub(new DateInterval('P' . ($today->format('N') - 1) . 'D')); // add the required number of weeks if ($n > 1) { $today->add(new DateInterval('P' . ($n - 1) . 'W')); } // and format the result return $today->format('d M') . '-' . $today->add(new DateInterval('P6D'))->format('d M'); } echo scoutWeekly(1) . "\n"; echo scoutWeekly(2) . "\n"; echo scoutWeekly(3) . "\n";
Output for git.master, git.master_jit, rfc.property-hooks
28 Jan-03 Feb 04 Feb-10 Feb 11 Feb-17 Feb

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