3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function secondsFromTime($time) { list($hours, $minutes, $seconds) = sscanf($time, "%d:%d:%d"); return $hours * 3600 + $minutes * 60 + (isset($seconds) ? $seconds : 0); } var_dump(secondsFromTime('0:01')); var_dump(secondsFromTime('0:01:01')); var_dump(secondsFromTime('1:01')); var_dump(secondsFromTime('1:01:01')); var_dump(secondsFromTime('01:01')); var_dump(secondsFromTime('01:01:01'));
Output for 4.3.0 - 7.2.0
int(60) int(61) int(3660) int(3661) int(3660) int(3661)