3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array("400 seconds", "400.1 seconds", "400.12 seconds", "400.123 seconds"); foreach ($tests as $index => $test) { var_dump($test); var_dump(DateInterval::createFromDateString($test)->format("%Hh, %im, %ss")); var_dump(date_parse($test)); }
Output for git.master, git.master_jit
string(11) "400 seconds" string(13) "00h, 0m, 400s" array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) ["relative"]=> array(6) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(400) } } string(13) "400.1 seconds" Warning: DateInterval::createFromDateString(): Unknown or bad format (400.1 seconds) at position 0 (4): Unexpected character in /in/9S45j on line 6 Fatal error: Uncaught Error: Call to a member function format() on bool in /in/9S45j:6 Stack trace: #0 {main} thrown in /in/9S45j on line 6
Process exited with code 255.
Output for rfc.property-hooks
string(11) "400 seconds" string(13) "00h, 0m, 400s" array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) ["relative"]=> array(6) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(400) } } string(13) "400.1 seconds" Fatal error: Uncaught DateMalformedIntervalStringException: Unknown or bad format (400.1 seconds) at position 0 (4): Unexpected character in /in/9S45j:6 Stack trace: #0 /in/9S45j(6): DateInterval::createFromDateString('400.1 seconds') #1 {main} thrown in /in/9S45j on line 6
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:
39.5 ms | 402 KiB | 8 Q