3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dt = new \DateTime(); $olderDt = (clone $dt)->sub(new \DateInterval('PT1D')); print_r($dt); print_r($olderDt);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Exception: DateInterval::__construct(): Unknown or bad format (PT1D) in /in/HN49J:4 Stack trace: #0 /in/HN49J(4): DateInterval->__construct('PT1D') #1 {main} thrown in /in/HN49J on line 4
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/HN49J 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/HN49J on line 4
Process exited with code 255.