3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/London'); $format = 'Y-m-d H:i e'; $times = array( '2015-10-24 15:00:00 01:00:00 BST', '2015-10-25 15:00:00 01:00:00 BST', '2015-10-26 15:00:00 01:00:00 BST' ); foreach ($times as $time) { $dt = DateTime::createFromFormat('Y-m-d H:i:s', $time, new DateTimeZone('Europe/London')); echo "Localised:\n"; echo $dt->format($format) . "\n\n"; echo "Putting into UTC:\n"; $dt->setTimezone(new DateTimeZone('UTC')); echo $dt->format($format) . "\n\n"; }
Output for 8.3.0 - 8.3.7
Localised: Fatal error: Uncaught Error: Call to a member function format() on false in /in/WjpvU:16 Stack trace: #0 {main} thrown in /in/WjpvU on line 16
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.19
Localised: Fatal error: Uncaught Error: Call to a member function format() on bool in /in/WjpvU:16 Stack trace: #0 {main} thrown in /in/WjpvU on line 16
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
Localised: Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/WjpvU:16 Stack trace: #0 {main} thrown in /in/WjpvU on line 16
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Localised: Fatal error: Call to a member function format() on boolean in /in/WjpvU on line 16
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Localised: Fatal error: Call to a member function format() on a non-object in /in/WjpvU on line 16
Process exited with code 255.

preferences:
237.2 ms | 402 KiB | 378 Q