3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime; $dt_c = (clone $dt)->sub(new DateInterval('P7D')); print_r($dt_c);
based on fDmOO
Output for 7.2.0
DateTime Object ( [date] => 2015-12-31 10:38:30.004905 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.10
DateTime Object ( [date] => 2015-12-31 10:38:30.004677 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.7
DateTime Object ( [date] => 2015-12-31 10:38:30.002758 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.6
DateTime Object ( [date] => 2015-12-31 10:38:30.013134 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.5
DateTime Object ( [date] => 2015-12-31 10:38:30.005710 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.1.0
DateTime Object ( [date] => 2015-12-31 10:38:30.003921 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.20
DateTime Object ( [date] => 2015-12-31 10:38:30.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.6
DateTime Object ( [date] => 2016-05-14 13:27:52.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.5
DateTime Object ( [date] => 2016-03-27 09:28:49.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.4
DateTime Object ( [date] => 2016-03-03 21:35:21.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.3
DateTime Object ( [date] => 2016-03-11 23:00:05.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.2
DateTime Object ( [date] => 2016-03-16 05:13:18.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.1
DateTime Object ( [date] => 2016-03-17 08:19:52.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.0
DateTime Object ( [date] => 2016-03-20 10:13:12.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/ZFt1X on line 5
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/ZFt1X on line 5
Process exited with code 255.