Created
November 7, 2018 14:18
-
-
Save awps/f683ce8dbb82fba705041ee336ea6dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function everyTimeFrame($totalMinutes = 4, $lastSeconds = 16) | |
{ | |
$time = []; | |
for ($i = 0; $i <= 59; $i++) { | |
for ($j = 0; $j <= $totalMinutes; $j++) { | |
$second = strlen($i) > 1 ? $i : "0{$i}"; | |
if ($j == $totalMinutes && $i > $lastSeconds) { | |
break; | |
} else { | |
$time[$j][] = "{$j}:{$second}"; | |
} | |
} | |
} | |
$time = array_map(function ($frames) { | |
return implode(', ', $frames); | |
}, $time); | |
return implode(', ', $time); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Define the minutes and seconds. The default values are 4 and 16. That's equal to
4:16
and will be transformed in: