3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nextMonth($thisMonth, $monthInc) { $firstOfThis = date("Y-m", strtotime($thisMonth)); $dNow = date("t", strtotime($thisMonth)); $dNext = date("t", strtotime($firstOfThis . " +" . $monthInc . " month")); $dDay = date("d", strtotime($thisMonth)); $output = date("Y-m-d",strtotime($thisMonth . " +" . $monthInc . " month")); if ($dNext < $dNow && $dNext < $dDay) { $output = date("Y-m", strtotime($firstOfThis . " +" . $monthInc . " month")) . '-' . $dNext; } return $output . "\n"; } echo nextMonth("2009-12-31",2); echo nextMonth("2010-01-31",1); echo nextMonth("2010-01-05",1); echo nextMonth("2010-12-05",1); exit(); ?>
Output for git.master, git.master_jit, rfc.property-hooks
2010-02-28 2010-02-28 2010-02-05 2011-01-05

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:
51.57 ms | 401 KiB | 8 Q