php get time difference by milliseconds

this is a function that calculates the difference between two times with milliseconds. i built it for a racing website to compare drivers.