3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startDate = new \DateTime(); $startDate->setDate(2014, 01, 30); $startDate->setTime(0, 0, 0); var_dump($startDate); $nextMonth = clone $startDate; $nextMonth->modify('+ 14 days'); $nextMonth->setDate($nextMonth->format('Y'), $nextMonth->format('m'), $nextMonth->format('t')); // $nextMonth->modify('last day of the month'); var_dump($nextMonth); $startDate->add(new DateInterval(sprintf('P%dD', $startDate->format('t')))); $startDate->sub(new DateInterval('P1D')); $startDate->setTime(23, 59, 59); while ($startDate >= $nextMonth) { $startDate->sub(new DateInterval('P1D')); } var_dump($startDate); $newDate = new \DateTime(); $newDate->setDate(2014, 02, 27); $newDate->setTime(23, 59, 59); var_dump($newDate->getTimestamp() == $startDate->getTimestamp());
Output for git.master, git.master_jit, rfc.property-hooks
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-30 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2014-02-28 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2014-02-27 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(true)

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