<?php
function countup( $steps )
{
// Internal State
$counter = 1;
$run = function() use ( $steps, &$counter, &$run )
{
if( $counter > $steps ) return;
echo $counter++;
// Calling the Inner Function Recursively
$run();
};
$run();
}
countup( 5 );
Created
April 13, 2020 20:50
-
-
Save nezarfadle/f2630e9b5c677af8f7b23c0ea82a040a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment