3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $nowTime = new DateTime; $programTime = new DateTime(date('Y-m-d') . " 18:30"); $lengthSeconds = 1200; $endDate = clone $programTime; $endDate->add(new \DateInterval('PT' . $lengthSeconds . 'S')); var_dump($endDate->getTimestamp() - $programTime->getTimestamp());
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(1200)
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rjfLZ on line 7 Fatal error: Call to undefined method DateTime::add() in /in/rjfLZ on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/rjfLZ on line 7 Fatal error: Class 'DateTime' not found in /in/rjfLZ on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/rjfLZ on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/rjfLZ on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/rjfLZ on line 6
Process exited with code 255.