3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $running_time = $_SERVER['REQUEST_TIME']; // calculated before, type DateInterval. Echoing the formatted value shows correct time $total = DateTime::createFromFormat('%I:%S', "10:00"); // ten minutes, 0 seconds expected total running time echo "\n"; $running_time = DateTime::createFromFormat('U', $running_time); echo "\n"; echo $running_time = $running_time->format('%I:%S'); echo "\n"; echo $time_left = $total->diff(new DateTime($running_time)); // fatal error
Output for 8.3.0 - 8.3.6
1419917011 %0:%th Fatal error: Uncaught Error: Call to a member function diff() on false in /in/BKJGH:10 Stack trace: #0 {main} thrown in /in/BKJGH on line 10
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
1419917011 %0:%th Fatal error: Uncaught Error: Call to a member function diff() on bool in /in/BKJGH:10 Stack trace: #0 {main} thrown in /in/BKJGH on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
1419917011 %0:%th Fatal error: Uncaught Error: Call to a member function diff() on boolean in /in/BKJGH:10 Stack trace: #0 {main} thrown in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.6.0 - 5.6.40
1419917011 %0:%th Fatal error: Call to a member function diff() on boolean in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.4.0, 5.4.3 - 5.4.42, 5.4.44 - 5.4.45, 5.5.0 - 5.5.26, 5.5.28 - 5.5.38
1419917011 %0:%th Fatal error: Call to a member function diff() on a non-object in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.4.1 - 5.4.2, 5.4.43, 5.5.27
1419917012 %0:%th Fatal error: Call to a member function diff() on a non-object in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.3.14 - 5.3.29
1419917020 %0:%th Fatal error: Call to a member function diff() on a non-object in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.13
1419917021 %0:%th Fatal error: Call to a member function diff() on a non-object in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.2.14 - 5.2.17
1419917021 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/BKJGH on line 4
Process exited with code 255.
Output for 5.2.10 - 5.2.13
1419917022 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/BKJGH on line 4
Process exited with code 255.
Output for 5.2.0 - 5.2.9
1419917022 Fatal error: Call to undefined method DateTime::createfromformat() in /in/BKJGH on line 4
Process exited with code 255.
Output for 5.1.1 - 5.1.6
1419917022 Fatal error: Class 'DateTime' not found in /in/BKJGH on line 4
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/BKJGH on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Notice: Undefined index: REQUEST_TIME in /in/BKJGH on line 2 Fatal error: Class 'DateTime' not found in /in/BKJGH on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Notice: Undefined index: REQUEST_TIME in /in/BKJGH on line 2 Fatal error: Undefined class name 'datetime' in /in/BKJGH on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: REQUEST_TIME in /in/BKJGH on line 2 Fatal error: Undefined class name 'datetime' in /in/BKJGH on line 4

preferences:
356.69 ms | 401 KiB | 459 Q