3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i = 1; // week number starts at 1 $date1 = new DateTime('2018-03-21'); $date2 = new DateTime('2018-05-14'); while (true) { echo "Week {$i}\n"; echo $date1->format('Y-m-d'), ' - '; $date1->modify('next saturday'); if ($date1 >= $date2) { echo $date2->format('Y-m-d'); break; // stop the loop, reached the end date, echo the last date, or whatever you want } echo $date1->format('Y-m-d') , "\n"; $date1->modify('next monday'); // start again on monday $i++; // increment for next week }
Output for git.master, git.master_jit, rfc.property-hooks
Week 1 2018-03-21 - 2018-03-24 Week 2 2018-03-26 - 2018-03-31 Week 3 2018-04-02 - 2018-04-07 Week 4 2018-04-09 - 2018-04-14 Week 5 2018-04-16 - 2018-04-21 Week 6 2018-04-23 - 2018-04-28 Week 7 2018-04-30 - 2018-05-05 Week 8 2018-05-07 - 2018-05-12 Week 9 2018-05-14 - 2018-05-14

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:
47.38 ms | 402 KiB | 8 Q