3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime(); $dates[] = $now; $dates[] = $now->add('P1D'); var_dump($dates);
based on EdrKi
Output for 7.1.0
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2014-08-14 10:09:55.003988" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.14
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2014-08-14 10:09:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.6
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-03 09:41:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.5
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 22:34:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.4
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-10 09:06:29.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.3
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-18 09:43:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.2
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-22 15:37:20.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.1
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-23 20:22:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 7.0.0
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-26 21:55:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.21
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-02 05:03:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.20
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-09 21:30:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.19
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-07 17:14:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.18
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-15 01:08:42.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.17
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-19 13:59:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.16
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-27 23:40:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.15
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-29 00:45:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.14
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-02 03:06:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.13
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-15 07:01:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.12
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-19 20:45:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.11
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-23 03:49:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.10
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-25 05:33:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.9
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-27 10:31:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.6.8
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-29 18:36:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.35
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-22 08:46:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.34
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-10 23:51:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.33
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-08 20:11:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.32
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-17 02:51:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.31
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-03-20 16:44:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.30
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-01 02:41:35.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.29
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-16 21:06:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.28
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-20 23:50:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.27
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-22 02:20:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.26
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-26 08:00:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.25
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-04-28 14:18:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.5.24
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2016-05-23 21:39:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.45
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.44
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.43
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.42
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:14.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.41
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.40
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.39
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-09-21 12:27:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.38
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-05 15:36:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.37
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-05 15:36:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.35 - 5.4.36
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-05 15:36:17.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.34
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2015-03-05 15:36:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.32
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2014-08-28 11:13:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.30 - 5.4.31
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(26) "2014-08-14 10:10:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.18 - 5.4.29
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-14 10:10:01" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.4.8 - 5.4.17
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-14 10:10:02" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.3.25 - 5.3.28, 5.4.0 - 5.4.7
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-14 10:10:03" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.3.29
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-28 11:13:56" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.3.13 - 5.3.24
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-14 10:10:04" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.3.0 - 5.3.12
Warning: DateTime::add() expects parameter 1 to be DateInterval, string given in /in/Dc470 on line 4 array(2) { [0]=> object(DateTime)#1 (3) { ["date"]=> string(19) "2014-08-14 10:10:05" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } [1]=> bool(false) }
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::add() in /in/Dc470 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Dc470 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/Dc470 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/Dc470 on line 2