3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set("America/New_York"); $xx = new DateTime(); $x = $xx->format('W'); $now = new DateTime('Sunday of week ' . $x); $y = $now->format('D'); echo $y;
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (Sunday of week 44) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught Exception: Failed to parse time string (Sunday of week 44) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 44) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.6
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 18) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.5
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 13) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.4
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 10) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.3
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 11) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.2
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (Sunday of week 12) at position 7 (o): The timezone could not be found in the database in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 44) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.6.21
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 18) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.6.20
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 14) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.33, 5.6.19
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 10) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.31 - 5.5.32, 5.6.17 - 5.6.18
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 11) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.30, 5.6.14 - 5.6.16
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 13) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.29, 5.5.34, 5.6.13
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 15) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.27 - 5.5.28, 5.6.11 - 5.6.12
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 16) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.25 - 5.5.26, 5.6.8 - 5.6.10
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 17) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.35
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 20) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.
Output for 5.5.24
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (Sunday of week 21) at position 7 (o): The timezone could not be found in the database' in /in/pn7v7:6 Stack trace: #0 /in/pn7v7(6): DateTime->__construct('Sunday of week ...') #1 {main} thrown in /in/pn7v7 on line 6
Process exited with code 255.

preferences:
191.47 ms | 401 KiB | 228 Q