SyntaxFix
Write A Post
Hire A Developer
Questions
Try this:
$time = "21:30:10"; $timeArr = array_reverse(explode(":", $time)); $seconds = 0; foreach ($timeArr as $key => $value) { if ($key > 2) break; $seconds += pow(60, $key) * $value; } echo $seconds;