3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format($timezone) { $d = new \DateTime('now', new \DateTimeZone($timezone)); return $d->format('Y-m-d H:i:s.u ' . $d->getTimeZone()->getLocation() ? 'e (P)' : 'P'); } echo format('Europe/Paris') . PHP_EOL; echo format('UTC') . PHP_EOL; echo format('+02:00') . PHP_EOL; echo format('GMT+2') . PHP_EOL;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Warning: Array to string conversion in /in/Yo88W on line 7 Europe/Paris (+02:00) Warning: Array to string conversion in /in/Yo88W on line 7 UTC (+00:00) +02:00 (+02:00) +02:00 (+02:00)
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: Array to string conversion in /in/Yo88W on line 7 Europe/Paris (+02:00) Notice: Array to string conversion in /in/Yo88W on line 7 UTC (+00:00) +02:00 (+02:00) +02:00 (+02:00)
Output for 7.3.32 - 7.3.33
Europe/Paris (+02:00) UTC (+00:00) +02:00 (+02:00) +02:00 (+02:00)

preferences:
165.42 ms | 401 KiB | 170 Q