3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ts = strtotime('2010-01-31 +1 month'); echo date('Y-m-d', $ts),"\n"; $dt = new \DateTime('2010-01-31'); $dt->add(new \DateInterval('P1M')); echo $dt->format('Y-m-d'),"\n"; $ts = strtotime('2010-01-05 +1 month'); echo date('Y-m-d', $ts),"\n"; $dt = new \DateTime('2010-01-05'); $dt->add(new \DateInterval('P1M')); echo $dt->format('Y-m-d'),"\n"; $orig = strtotime('2010-01-31'); $ts1 = strtotime('+1 month', $orig); $ts2 = strtotime('last day of next month', $orig); $ts = $ts1; if ($ts1 > $ts2) { $ts = $ts2; } echo date('Y-m-d', $ts),"\n"; $orig = new \DateTime('2010-01-31'); $dt1 = clone $orig; $dt1->add(new \DateInterval('P1M')); $dt2 = clone $orig; $dt2->modify('last day of next month'); $dt = $dt1; if ($dt1 > $dt2) { $dt = $dt2; } echo $dt->format('Y-m-d'),"\n";
Output for git.master, git.master_jit, rfc.property-hooks
2010-03-03 2010-03-03 2010-02-05 2010-02-05 2010-02-28 2010-02-28

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