3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); function toDateInterval(string $interval): DateInterval { if (false === ($res = DateInterval::createFromDateString($interval))) { throw new Exception('Invalid string.'); } return $res; } var_dump(toDateInterval('foobar'));
Output for git.master, git.master_jit
Warning: DateInterval::createFromDateString(): Unknown or bad format (foobar) at position 0 (f): The timezone could not be found in the database in /in/IPOmh on line 5 Fatal error: Uncaught Exception: Invalid string. in /in/IPOmh:6 Stack trace: #0 /in/IPOmh(13): toDateInterval('foobar') #1 {main} thrown in /in/IPOmh on line 6
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught DateMalformedIntervalStringException: Unknown or bad format (foobar) at position 0 (f): The timezone could not be found in the database in /in/IPOmh:5 Stack trace: #0 /in/IPOmh(5): DateInterval::createFromDateString('foobar') #1 /in/IPOmh(13): toDateInterval('foobar') #2 {main} thrown in /in/IPOmh on line 5
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:
27.32 ms | 407 KiB | 5 Q