3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $s = 84600; // 23.5 h in seconds $s2 += (60*60*24)*38; // add 38 days in seconds $d = (new \DateTime())->modify("-".$s2."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 VRcFC
Output for 5.4.10 - 5.6.28, 7.0.1 - 7.2.0
Notice: Undefined variable: s2 in /in/FqLgM on line 4 38 days 0:00 0 days 23:30
Output for 7.0.0
Notice: Undefined variable: s2 in /in/FqLgM on line 4 38 days 0:00 1 days 0:30
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/FqLgM on line 5
Process exited with code 255.