3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new \DateTime('2016-01-01'); $olderDt = (clone $dt)->sub(new \DateInterval('P1D')); print_r($dt); print_r($olderDt);
based on VVuDQ
Output for 7.0.0 - 7.2.0
DateTime Object ( [date] => 2016-01-01 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) DateTime Object ( [date] => 2015-12-31 00:00:00.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/rb8AV 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/rb8AV on line 4
Process exited with code 255.