Get Amount of Hours Between 2 Hours


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

function timeDiff($firstTime,$lastTime) {
  $firstTime=strtotime($firstTime);
  $lastTime=strtotime($lastTime);
  $timeDiff=$lastTime-$firstTime;
  return $timeDiff;
}

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