3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function get_time_difference($time1, $time2) { $time1 = strtotime("1980-01-01 $time1"); $time2 = strtotime("1980-01-01 $time2"); if ($time2 < $time1) { $time2 += 86400; } return date("H:i", strtotime("1980-01-01 00:00") + ($time2 - $time1)); } echo get_time_difference("10:25", "22:40"); // 12:15 ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
12:15