title: PHP - hours difference (HH:MM format)
body: <p>I'm trying to calculate the shift patterns of people who work here, subtracting the start time from the end time works for the most part, but not if they're working overnight. For example someone working from <code>10pm to 6am</code> would be displayed as:</p>
  
  <pre><code>22:00 - 06:00
  </code></pre>
  
  <p>I'd like that to return <code>8 hours</code>, but I just can't figure out the best way of doing it.</p>
  
  <p>Annoyingly, I'm then going to have to do the exact same thing in Javascript, so I hope I can get my head around the logic for this. Taking away one date from the other just doesn't work in this case...</p>
  
  <p>Any help would be much appreciated, thank you!</p>