3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(getHourFormatForTimingGraph("0")); var_dump(getHourFormatForTimingGraph("3")); var_dump(getHourFormatForTimingGraph("12")); var_dump(getHourFormatForTimingGraph("20")); function getHourFormatForTimingGraph($str) { $dt = DateTime.createFromFormat('Y-m-d H:i:s',$str); return $dt; }
based on knSrS
Output for 7.2.0
Warning: Use of undefined constant DateTime - assumed 'DateTime' (this will throw an Error in a future version of PHP) in /in/s55Vq on line 9 Fatal error: Uncaught Error: Call to undefined function createFromFormat() in /in/s55Vq:9 Stack trace: #0 /in/s55Vq(2): getHourFormatForTimingGraph('0') #1 {main} thrown in /in/s55Vq on line 9
Process exited with code 255.
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant DateTime - assumed 'DateTime' in /in/s55Vq on line 9 Fatal error: Uncaught Error: Call to undefined function createFromFormat() in /in/s55Vq:9 Stack trace: #0 /in/s55Vq(2): getHourFormatForTimingGraph('0') #1 {main} thrown in /in/s55Vq on line 9
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Notice: Use of undefined constant DateTime - assumed 'DateTime' in /in/s55Vq on line 9 Fatal error: Call to undefined function createFromFormat() in /in/s55Vq on line 9
Process exited with code 255.