This is fairly easy to parse manually. To convert this to an amount of time in milliseconds, which is probably what you'd want to do, just do this:
function lap_time_to_millis($lap) {
$components = explode('.', $lap);
$time_components = explode(':', $components[0]);
return intval($components[1])
+ intval($time_components[2]) * 1000
+ intval($time_components[1]) * 60000
+ intval($time_components[0]) * 3600000;
}
Then, to convert milliseconds to a lap format, use this:
function millis_to_lap_time($millis) {
$hrs = intval($millis / 3600000);
$mins = str_pad(intval($millis / 60000) % 60, 2, '0', STR_PAD_LEFT);
$secs = str_pad(intval($millis / 1000) % 60, 2, '0', STR_PAD_LEFT);
$milli = str_pad($millis % 1000, 3, '0', STR_PAD_LEFT);
return "$hrs:$mins:$secs.$milli";
}