3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $serviceStart = new DateTime('8/20/2012'); $serviceEnd = $serviceStart->modify('+2 years'); $diff = $serviceStart->diff($serviceEnd); var_dump($diff->format('%a'), $serviceStart, $serviceEnd); $serviceStart = new DateTime('8/20/2012'); $serviceEnd = new DateTime('8/20/2012')->modify('+2 years'); $diff = $serviceStart->diff($serviceEnd); var_dump($diff->format('%a'), $serviceStart, $serviceEnd);
Output for 5.4.0 - 5.5.1
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/FnamD on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/FnamD on line 11
Process exited with code 255.