3v4l.org

run code in 200+ PHP versions simultaneously
<?php $tzsp = new \DateTimeZone('America/Sao_Paulo'); $tzgmt = new \DateTimeZone('GMT-3'); $baseDate = \DateTime::createFromFormat(\DateTime::ISO8601, '2015-06-23T18:00:00-0300'); echo "GMT-3 ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzsp); echo "America/Sao_Paulo ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzgmt); echo "GMT-3 ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzsp); echo "America/Sao_Paulo ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzgmt); echo "GMT-3 ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzsp); echo "America/Sao_Paulo ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzgmt); echo "GMT-3 ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzsp); echo "America/Sao_Paulo ", $baseDate->format(\DateTime::ISO8601), "\n"; $baseDate->setTimezone($tzgmt); echo "GMT-3 ", $baseDate->format(\DateTime::ISO8601), "\n";
Output for 7.0.20, 7.1.5 - 7.3.1
GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-23T18:00:00-0300
Output for 5.5.24 - 7.0.6, 7.1.0
GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T15:00:00-0300 GMT-3 2015-06-23T15:00:00-0300 America/Sao_Paulo 2015-06-23T12:00:00-0300 GMT-3 2015-06-23T12:00:00-0300 America/Sao_Paulo 2015-06-23T09:00:00-0300 GMT-3 2015-06-23T09:00:00-0300
Output for 5.3.0 - 5.3.2, 5.3.6 - 5.4.45
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (GMT-3)' in /in/8Gm26:4 Stack trace: #0 /in/8Gm26(4): DateTimeZone->__construct('GMT-3') #1 {main} thrown in /in/8Gm26 on line 4
Process exited with code 255.
Output for 5.3.3 - 5.3.5
GMT-3 2015-06-23T18:00:00-0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-24T00:00:00+0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-24T00:00:00+0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-24T00:00:00+0300 America/Sao_Paulo 2015-06-23T18:00:00-0300 GMT-3 2015-06-24T00:00:00+0300
Output for 5.2.14 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 19 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 25 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 28 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 31 Fatal error: Call to undefined method DateTime::createFromFormat() in /in/8Gm26 on line 6
Process exited with code 255.
Output for 5.2.0 - 5.2.13
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 19 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 25 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 28 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 31 Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (GMT-3)' in /in/8Gm26:4 Stack trace: #0 /in/8Gm26(4): DateTimeZone->__construct('GMT-3') #1 {main} thrown in /in/8Gm26 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 10 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 13 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 16 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 19 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 25 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 28 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 31 Fatal error: Class 'DateTimeZone' not found in /in/8Gm26 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Parse error: syntax error, unexpected ',', expecting '(' in /in/8Gm26 on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Parse error: parse error, unexpected ',', expecting '(' in /in/8Gm26 on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8Gm26 on line 6 Parse error: parse error, expecting `'('' in /in/8Gm26 on line 6
Process exited with code 255.