If you would like to get the amount of hours between 10:00 and 12:00 then use this!

1
2
3
4
5
6
7
8
function timeDiff($firstTime,$lastTime) {
  $firstTime=strtotime($firstTime);
  $lastTime=strtotime($lastTime);
  $timeDiff=$lastTime-$firstTime;
  return $timeDiff;
}

echo (timeDiff("10:00","12:00")/60)/60;