3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime('now'); $date->add(new DateInterval('P2Y9M')); echo $date->format('Y-m-d H:i:s') . "\n";
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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2017-07-30 17:35:13
Output for 7.3.32 - 7.3.33, 8.0.13
2017-07-30 16:35:13
Output for 7.0.6
2019-02-03 05:05:45
Output for 7.0.5
2019-01-02 18:13:55
Output for 7.0.4
2018-12-10 04:04:19
Output for 7.0.3
2018-12-18 04:23:51
Output for 7.0.2
2018-12-21 14:51:32
Output for 7.0.1
2018-12-23 15:29:41
Output for 7.0.0
2018-12-26 17:20:11
Output for 5.6.21
2019-02-02 00:09:31
Output for 5.6.20
2019-01-09 13:28:37
Output for 5.6.19
2018-12-07 03:28:28
Output for 5.6.18
2018-12-14 17:03:51
Output for 5.6.17
2018-12-19 08:48:33
Output for 5.6.16
2018-12-27 19:06:16
Output for 5.6.15
2018-12-28 19:58:07
Output for 5.6.14
2019-01-01 22:31:20
Output for 5.6.13
2019-01-15 02:31:26
Output for 5.6.12
2019-01-19 15:48:37
Output for 5.6.11
2019-01-22 22:55:49
Output for 5.6.10
2019-01-25 00:34:24
Output for 5.6.9
2019-01-27 05:46:52
Output for 5.6.8
2019-01-29 13:34:52
Output for 5.5.35
2019-02-22 03:56:50
Output for 5.5.34
2019-01-10 19:26:18
Output for 5.5.33
2018-12-08 14:58:25
Output for 5.5.32
2018-12-16 20:48:49
Output for 5.5.31
2018-12-20 11:40:15
Output for 5.5.30
2018-12-31 21:58:54
Output for 5.5.29
2019-01-16 16:36:02
Output for 5.5.28
2019-01-20 18:59:05
Output for 5.5.27
2019-01-21 21:21:52
Output for 5.5.26
2019-01-26 03:09:10
Output for 5.5.25
2019-01-28 09:06:30
Output for 5.5.24
2019-02-24 14:56:58
Output for 5.4.45
2018-06-07 02:24:03
Output for 5.4.44
2018-06-07 02:24:00
Output for 5.4.43
2018-06-07 02:23:57
Output for 5.4.42
2018-06-07 02:23:55
Output for 5.4.41
2018-06-07 02:23:53
Output for 5.4.40
2018-06-07 02:23:52
Output for 5.4.39
2018-06-07 02:23:50
Output for 5.4.38
2018-06-07 02:23:48
Output for 5.4.36 - 5.4.37
2018-06-07 02:23:46
Output for 5.4.35
2018-06-07 02:23:44
Output for 5.4.13 - 5.4.34
2017-07-30 17:35:18
Output for 5.3.21 - 5.3.29, 5.4.0 - 5.4.12
2017-07-30 17:35:19
Output for 5.3.0 - 5.3.20
2017-07-30 17:35:20
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::add() in /in/kEUGT on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/kEUGT on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/kEUGT on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/kEUGT on line 3

preferences:
220.83 ms | 401 KiB | 312 Q