3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.3.0 - 7.1.0
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" string(11) "00h, 0m, 0s" array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> int(0) ["minute"]=> int(1) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(1) ["warnings"]=> array(1) { [12]=> string(29) "Double timezone specification" } ["error_count"]=> int(2) ["errors"]=> array(2) { [0]=> string(20) "Unexpected character" [6]=> string(47) "The timezone could not be found in the database" } ["is_localtime"]=> bool(true) ["zone_type"]=> int(0) } string(14) "400.12 seconds" string(11) "00h, 0m, 0s" array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> int(0) ["minute"]=> int(12) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(1) ["warnings"]=> array(1) { [13]=> string(29) "Double timezone specification" } ["error_count"]=> int(2) ["errors"]=> array(2) { [0]=> string(20) "Unexpected character" [7]=> string(47) "The timezone could not be found in the database" } ["is_localtime"]=> bool(true) ["zone_type"]=> int(0) } string(15) "400.123 seconds" string(11) "00h, 0m, 3s" array(13) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> int(0) ["minute"]=> int(12) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> string(20) "Unexpected character" } ["is_localtime"]=> bool(false) ["relative"]=> array(6) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(3) } }
Output for 5.0.0 - 5.2.17
string(11) "400 seconds" Fatal error: Class 'DateInterval' not found in /in/9S45j on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/9S45j on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/9S45j on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/9S45j on line 6
Process exited with code 255.