3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intervals = array( '0' => 0, '86400' => 86400, '0 second' => 0, '1 second' => 1, '1 minute' => 60, '1 hour' => 60 * 60, '1 day' => 60 * 60 * 24, '1 year' => 60 * 60 * 24 * 365, '1 day + 12 hours' => 60 * 60 * 24 + 12 * 60 * 60 ); foreach ($intervals as $interval => $expected) { if (is_numeric($interval)) { $found = (int) $interval; } else { $zeroDate = new \DateTime('0'); // bug fix for php $zeroDate->modify(sprintf('-%s seconds', $zeroDate->getTimestamp())); $zeroDate->add(\DateInterval::createFromDateString($interval)); $found = $zeroDate->getTimestamp(); } echo sprintf("found %s expected %s\n", $found, $expected); }
Output for git.master, git.master_jit
found 0 expected 0 found 86400 expected 86400 Fatal error: Uncaught Exception: Failed to parse time string (0) at position 0 (0): Unexpected character in /in/m7lY2:18 Stack trace: #0 /in/m7lY2(18): DateTime->__construct('0') #1 {main} thrown in /in/m7lY2 on line 18
Process exited with code 255.
Output for rfc.property-hooks
found 0 expected 0 found 86400 expected 86400 Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (0) at position 0 (0): Unexpected character in /in/m7lY2:18 Stack trace: #0 /in/m7lY2(18): DateTime->__construct('0') #1 {main} thrown in /in/m7lY2 on line 18
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:
32.34 ms | 401 KiB | 8 Q