3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo date('H:i:s Y-m-d',strtotime("midnight today")); $d = new DateTime("2015-11-05 16:00:00") - new DateTime("midnight today"); echo "[" . $d->format('Y-m-d H:i:s') . "]\n";
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
00:00:00 2015-11-05 Fatal error: Uncaught TypeError: Unsupported operand types: DateTime - DateTime in /in/TtX5U:4 Stack trace: #0 {main} thrown in /in/TtX5U on line 4
Process exited with code 255.
Output for 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
00:00:00 2015-11-05 Notice: Object of class DateTime could not be converted to number in /in/TtX5U on line 4 Notice: Object of class DateTime could not be converted to number in /in/TtX5U on line 4 Fatal error: Uncaught Error: Call to a member function format() on int in /in/TtX5U:5 Stack trace: #0 {main} thrown in /in/TtX5U on line 5
Process exited with code 255.
Output for 7.3.32 - 7.3.33
00:00:00 2015-11-05 Fatal error: Uncaught Error: Call to a member function format() on int in /in/TtX5U:5 Stack trace: #0 {main} thrown in /in/TtX5U on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
00:00:00 2015-11-05 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Fatal error: Uncaught Error: Call to a member function format() on integer in /in/TtX5U:5 Stack trace: #0 {main} thrown in /in/TtX5U on line 5
Process exited with code 255.
Output for 5.6.0 - 5.6.25
00:00:00 2015-11-05 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Fatal error: Call to a member function format() on integer in /in/TtX5U on line 5
Process exited with code 255.
Output for 5.5.0 - 5.5.38
00:00:00 2015-11-05 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Notice: Object of class DateTime could not be converted to int in /in/TtX5U on line 4 Fatal error: Call to a member function format() on a non-object in /in/TtX5U on line 5
Process exited with code 255.

preferences:
160.83 ms | 401 KiB | 220 Q