3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $days = 7; $date1 = (new \DateTime())->add(new \DateInterval('P'.($days -1).'D')); $date2 = (new \DateTime())->modify('+'.$days.' day')); var_dump($date1, $date2);
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected ')' in /in/bDp5u on line 4
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/bDp5u on line 3
Process exited with code 255.