3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new \DateTime('50 years ago'); echo $date->format('Y-m-d H:i:s');
Output for 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
1964-10-13 12:54:14
Output for 7.3.32 - 7.3.33, 8.0.13
1964-10-13 10:54:14
Output for 7.0.6
1966-05-03 10:24:13
Output for 7.0.5
1966-04-02 23:10:29
Output for 7.0.4
1966-03-10 09:46:56
Output for 7.0.3
1966-03-18 10:26:44
Output for 7.0.2
1966-03-22 16:25:15
Output for 7.0.1
1966-03-23 21:00:36
Output for 7.0.0
1966-03-26 22:32:59
Output for 5.6.21
1966-05-02 05:43:42
Output for 5.6.20
1966-04-09 22:10:01
Output for 5.6.19
1966-03-07 17:54:09
Output for 5.6.18
1966-03-15 02:00:20
Output for 5.6.17
1966-03-19 14:40:21
Output for 5.6.16
1966-03-28 00:30:04
Output for 5.6.15
1966-03-29 01:25:24
Output for 5.6.14
1966-04-02 03:44:25
Output for 5.6.13
1966-04-15 07:38:44
Output for 5.6.12
1966-04-19 21:27:05
Output for 5.6.11
1966-04-23 04:29:02
Output for 5.6.10
1966-04-25 06:13:49
Output for 5.6.9
1966-04-27 11:12:59
Output for 5.6.8
1966-04-29 19:21:16
Output for 5.5.35
1966-05-22 09:31:24
Output for 5.5.34
1966-04-11 00:29:25
Output for 5.5.33
1966-03-08 20:51:07
Output for 5.5.32
1966-03-17 03:34:10
Output for 5.5.31
1966-03-20 17:25:36
Output for 5.5.30
1966-04-01 03:22:06
Output for 5.5.29
1966-04-16 21:45:57
Output for 5.5.28
1966-04-21 00:43:01
Output for 5.5.27
1966-04-22 03:00:36
Output for 5.5.26
1966-04-26 08:40:22
Output for 5.5.25
1966-04-28 14:58:55
Output for 5.5.24
1966-05-23 22:19:03
Output for 5.4.45
1965-09-21 14:52:22
Output for 5.4.44
1965-08-17 08:14:23
Output for 5.4.43
1965-08-17 08:14:19
Output for 5.4.42
1965-07-09 06:19:16
Output for 5.4.41
1965-07-09 06:19:14
Output for 5.4.40
1965-07-09 06:19:10
Output for 5.4.39
1965-07-09 06:19:09
Output for 5.4.38
1965-07-09 06:19:08
Output for 5.4.36 - 5.4.37
1965-07-09 06:19:06
Output for 5.4.34 - 5.4.35
1965-07-09 06:19:05
Output for 5.4.24 - 5.4.32
1964-10-13 12:54:18
Output for 5.4.2 - 5.4.23
1964-10-13 12:54:19
Output for 5.3.11 - 5.3.29, 5.4.0 - 5.4.1
1964-10-13 12:54:20
Output for 5.3.0 - 5.3.10
1964-10-13 12:54:21
Output for 5.2.5 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XWqCE on line 2 1964-10-13 12:54:21
Output for 5.2.0 - 5.2.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XWqCE on line 2 1964-10-13 12:54:22
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XWqCE on line 2 Fatal error: Class 'DateTime' not found in /in/XWqCE on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XWqCE on line 2 Fatal error: Cannot instantiate non-existent class: datetime in /in/XWqCE on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XWqCE on line 2 Fatal error: Cannot instantiate non-existent class: datetime in /in/XWqCE on line 2

preferences:
202.93 ms | 401 KiB | 308 Q