3v4l.org

run code in 300+ PHP versions simultaneously
<?php $from = new DateTime('2014-01-29'); $day = $from->format('j'); $from->modify('first day of this month'); //2014-01-01 $period = new DatePeriod($from, new DateInterval('P1M'), 12); foreach ($period as $date) { $lastDay = clone $date; $lastDay->modify('last day of this month'); $date->setDate($date->format('Y'), $date->format('n'), $day); if ($date > $lastDay) { $date = $lastDay; } echo $date->format('Y-m-d') . \PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
2014-01-29 2014-02-28 2014-03-29 2014-04-29 2014-05-29 2014-06-29 2014-07-29 2014-08-29 2014-09-29 2014-10-29 2014-11-29 2014-12-29 2015-01-29

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