3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date1 = new DateTime(time()); $date2 = clone $date1; $interval = new DateInterval('PT1H5M'); $date2->add($interval); $diff = $date2->diff($date1); echo $diff->format('%h hours %i minutes') /* lots of adding up to get complete interval as minutes this way */; echo PHP_EOL; print_r((array)$diff); echo PHP_EOL; echo ($date2->getTimestamp() - $date1->getTimestamp()) / 60; echo ' minutes';
based on GhDt2
Output for 7.1.0 - 7.2.0
1 hours 5 minutes Array ( [y] => 0 [m] => 0 [d] => 0 [h] => 1 [i] => 5 [s] => 0 [f] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 1 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) 65 minutes
Output for 5.4.17 - 7.0.20
1 hours 5 minutes Array ( [y] => 0 [m] => 0 [d] => 0 [h] => 1 [i] => 5 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 1 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 ) 65 minutes
Output for 5.4.0 - 5.4.16
1 hours 5 minutes Array ( [y] => 0 [m] => 0 [d] => 0 [h] => 1 [i] => 5 [s] => 0 [invert] => 1 [days] => 0 ) 65 minutes