3v4l.org

run code in 300+ PHP versions simultaneously
<?php $today = new DateTime('now'); $today_string = $today->format('Y-m-d'); $next_year = clone $today; $next_year->modify( '+1 year' ); $next_year_string = $next_year->format('Y-m-d'); echo $today->format('Y-m-d H:i:s');
Output for 5.3.6, 5.3.11, 5.3.15 - 5.3.16, 5.3.19, 5.4.5, 5.4.12, 5.4.15 - 5.4.26, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2014-03-19 22:26:57
Output for 7.3.32 - 7.3.33, 8.0.13
2014-03-19 21:26:57
Output for 7.0.6
2016-05-03 06:53:02
Output for 7.0.5
2016-04-02 19:53:32
Output for 7.0.4
2016-03-10 06:01:20
Output for 7.0.3
2016-03-18 06:28:02
Output for 7.0.2
2016-03-22 11:59:46
Output for 7.0.1
2016-03-23 17:24:02
Output for 7.0.0
2016-03-26 19:06:16
Output for 5.6.21
2016-05-02 02:10:06
Output for 5.6.20
2016-04-09 15:10:15
Output for 5.6.19
2016-03-07 06:59:55
Output for 5.6.18
2016-03-14 20:06:15
Output for 5.6.17
2016-03-19 10:48:42
Output for 5.6.16
2016-03-27 20:51:15
Output for 5.6.15
2016-03-28 21:43:39
Output for 5.6.14
2016-04-02 00:12:12
Output for 5.6.13
2016-04-15 04:16:16
Output for 5.6.12
2016-04-19 17:47:39
Output for 5.6.11
2016-04-23 00:45:53
Output for 5.6.10
2016-04-25 02:37:13
Output for 5.6.9
2016-04-27 07:35:52
Output for 5.6.8
2016-04-29 15:29:33
Output for 5.6.7
2016-05-25 07:21:21
Output for 5.5.35
2016-05-22 05:47:42
Output for 5.5.34
2016-04-10 21:07:57
Output for 5.5.33
2016-03-08 16:55:12
Output for 5.5.32
2016-03-16 22:57:56
Output for 5.5.31
2016-03-20 13:37:28
Output for 5.5.30
2016-03-31 23:43:26
Output for 5.5.29
2016-04-16 18:21:24
Output for 5.5.28
2016-04-20 20:51:31
Output for 5.5.27
2016-04-21 23:18:20
Output for 5.5.26
2016-04-26 05:03:02
Output for 5.5.25
2016-04-28 11:05:43
Output for 5.5.24
2016-05-23 17:59:53
Output for 5.4.45
2015-09-14 06:22:11
Output for 5.4.44
2015-09-14 06:22:09
Output for 5.4.43
2015-09-14 06:22:05
Output for 5.4.42
2015-09-14 06:22:04
Output for 5.4.41
2015-09-14 06:22:02
Output for 5.4.40
2015-05-15 01:43:16
Output for 5.4.39
2015-05-15 01:43:15
Output for 5.4.38
2015-03-02 15:17:44
Output for 5.4.37
2015-02-08 15:46:16
Output for 5.4.34 - 5.4.36
2015-02-08 15:46:15
Output for 5.4.32
2014-09-07 16:04:20
Output for 5.4.31
2014-09-07 16:04:15
Output for 5.4.29 - 5.4.30
2014-09-07 16:04:09
Output for 5.4.28
2014-09-07 16:04:08
Output for 5.4.27
2014-09-07 16:04:16
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.5, 5.3.7 - 5.3.10, 5.3.12 - 5.3.14, 5.3.17 - 5.3.18, 5.3.20 - 5.3.28, 5.4.0 - 5.4.4, 5.4.6 - 5.4.11, 5.4.13 - 5.4.14
2014-03-19 22:26:56
Output for 5.3.29
2014-09-07 16:04:10
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/PgnXK on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/PgnXK on line 4
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 T_VARIABLE in /in/PgnXK on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/PgnXK on line 4
Process exited with code 255.

preferences:
205.25 ms | 401 KiB | 344 Q