3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $end_date = new DateTime(date("Y-m-d H:i:s", strtotime("14:00"))); $begin_date = ; //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 = ($end_date)->diff(new DateTime(date("Y-m-d H:i:s", strtotime("09:15")))); $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 1Nt3H
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.4.34
Parse error: syntax error, unexpected ';' in /in/ikk5S on line 4
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 ';' in /in/ikk5S on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ikk5S on line 4
Process exited with code 255.