Skip to content

Commit

Permalink
update loop function
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyZ89 committed Nov 13, 2020
1 parent d518fb7 commit e94b9ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* @param callable $handle
* @param integer $count
*/
function loop($handle, $count)
function loop(callable $handle, int $count)
{
if ($count > 0) {
foreach (range(1, $count) as $i) {
$handle($i);
if ($handle($i) === false) {
break;
}
}
}
}
Expand Down

0 comments on commit e94b9ff

Please sign in to comment.