3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new \DateTime(); $olderDt = (clone $dt)->sub(new \DateInterval('P1D')); print_r($dt); print_r($olderDt);
based on HN49J
Output for 7.2.0
DateTime Object ( [date] => 2015-12-30 22:46:27.003938 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.003938 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.10
DateTime Object ( [date] => 2015-12-30 22:46:27.003662 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.003662 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.7
DateTime Object ( [date] => 2015-12-30 22:46:27.004932 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.004932 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.6
DateTime Object ( [date] => 2015-12-30 22:46:27.013058 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.013058 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.5
DateTime Object ( [date] => 2015-12-30 22:46:27.005664 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.005664 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.0
DateTime Object ( [date] => 2015-12-30 22:46:27.003931 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.003931 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.20
DateTime Object ( [date] => 2015-12-30 22:46:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-29 22:46:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.6
DateTime Object ( [date] => 2016-05-21 13:12:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-05-20 13:12:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.5
DateTime Object ( [date] => 2016-04-03 09:15:31.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-04-02 09:15:31.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.4
DateTime Object ( [date] => 2016-03-10 21:21:46.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-03-09 21:21:46.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.3
DateTime Object ( [date] => 2016-03-18 22:44:20.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-03-17 22:44:20.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.2
DateTime Object ( [date] => 2016-03-23 04:57:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-03-22 04:57:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.1
DateTime Object ( [date] => 2016-03-24 08:06:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-03-23 08:06:02.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.0
DateTime Object ( [date] => 2016-03-27 09:59:16.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2016-03-26 09:59:16.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/VVuDQ on line 4
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/VVuDQ on line 4
Process exited with code 255.