3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $s = 84600; // 23.5 h in seconds $s += (60*60*24)*38; // add 38 days in seconds $d = (new \DateTime())->modify("-".$s."seconds"); echo (new \DateTime())->diff($d)->format("%a days %h:%I"), PHP_EOL; $d = (new \DateTime())->sub(new DateInterval('PT'.$s.'S')); echo (new \DateTime())->diff($d)->format("%a days %h:%I"), PHP_EOL;
based on FqLgM
Output for 5.4.10 - 5.5.24, 5.5.31 - 5.5.33, 5.5.35, 5.6.17 - 5.6.19, 5.6.28, 7.0.1 - 7.0.4, 7.0.20 - 7.2.0
38 days 23:30 38 days 23:30
Output for 5.5.25 - 5.5.30, 5.5.34, 5.6.8 - 5.6.16, 5.6.20 - 5.6.21, 7.0.0, 7.0.5 - 7.0.6
38 days 23:30 39 days 0:30
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/ARhJ4 on line 5
Process exited with code 255.