We have a lot of strings for storing the time that it took participants to finish the track. There are basically 2 different types of those strings ( <1 hour and >1hour ):
54:37
01:12:20
hh:mm:ss
00:54:37
Simple way would be
$time = str_pad($time,8,'00:',STR_PAD_LEFT)
What it does: Fill the string with 00: from left to the full lenght of 8
or $time = strlen($time)==8?$time:"00:$time"
What it does: Check if string is 8 chars then do nothing else add 00:
This are solutions if really only the 2 different types are given.
This wont work: print date('H:i:s',strtotime('54:37'))