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->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
object(DateTime)#1 (3) { ["date"]=> string(26) "2014-01-30 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Warning: DateTime::modify(): Failed to parse time string (last day of the month) at position 12 (t): The timezone could not be found in the database in /in/7b5uE on line 9 object(DateTime)#2 (3) { ["date"]=> string(26) "2014-02-13 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2014-02-12 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 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" } Fatal error: Uncaught DateMalformedStringException: DateTime::modify(): Failed to parse time string (last day of the month) at position 12 (t): The timezone could not be found in the database in /in/7b5uE:9 Stack trace: #0 /in/7b5uE(9): DateTime->modify('last day of the...') #1 {main} thrown in /in/7b5uE on line 9
Process exited with code 255.

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