3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $n = '12:33'; var_dump(date('Y-m-d H:i:s', strtotime($n))); $dt = new DateTime($x); var_dump($dt->format('Y-m-d H:i:s'));
based on kgbFQ
Output for 5.2.0 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
string(19) "2014-10-06 12:33:00" Notice: Undefined variable: x in /in/d6BKt on line 4 string(19) "2014-10-06 15:03:07"
Output for hhvm-3.12.0
string(19) "2014-10-06 12:33:00" Notice: Undefined variable: x in /in/d6BKt on line 4 Fatal error: Uncaught exception 'Exception' with message '__construct() expects parameter 1 to be string, null given' in /in/d6BKt:4 Stack trace: #0 /in/d6BKt(4): DateTime->__construct() #1 {main}
Process exited with code 255.
Output for 5.0.0 - 5.1.6
string(19) "2014-10-06 12:33:00" Fatal error: Class 'DateTime' not found in /in/d6BKt on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
string(19) "2014-10-06 12:33:00" Fatal error: Cannot instantiate non-existent class: datetime in /in/d6BKt on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
string(19) "2014-10-06 12:33:00" Fatal error: Cannot instantiate non-existent class: datetime in /in/d6BKt on line 4