3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $begin_time = strtotime("09:15"); $end_time = strtotime("14:00"); echo "begin_date is " . $begin_date->format('Y-m-d H:i:s') . " and end_date is " . $end_date->format('Y-m-d H:i:s') . "<br>"; $diff = new DateTime(date("Y-m-d H:i:s", $end_time))->diff(new DateTime(date("Y-m-d H:i:s", $begin_time))); $diff_in_hours = $diff->h + $diff->i / 60; echo "The difference is " . $diff->h . " hours and " . $diff->i . " minutes, which is " . $diff_in_hours . " hours<br>";
based on OK2ms
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/HH2JM on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/HH2JM on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/HH2JM on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/HH2JM on line 8
Process exited with code 255.