3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('date.timezone', NULL); try { $date = new DateTime('2011-08-28T00:00:00+0000'); echo $date->format('O'); } catch (Exception $e) { echo 'Exception thrown.'; } echo PHP_EOL; date_default_timezone_set('America/New_York'); try { $date = new DateTime('2011-08-28T00:00:00+0000'); echo $date->format('O'); } catch (Exception $e) { echo 'Exception thrown.'; }
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: ini_set(): Invalid date.timezone value '', using 'Europe/Amsterdam' instead in /in/4iVJ8 on line 3 +0000 +0000
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33
+0000 +0000
Output for 5.4.12 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: ini_set(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. in /in/4iVJ8 on line 3 Exception thrown. +0000
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.11
Exception thrown. +0000
Output for 5.2.0 - 5.2.17
Strict Standards: DateTime::__construct(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /in/4iVJ8 on line 6 +0000 +0000
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/4iVJ8 on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/4iVJ8 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '{' in /in/4iVJ8 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/4iVJ8 on line 5
Process exited with code 255.

preferences:
139.71 ms | 417 KiB | 5 Q