Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created January 24, 2013 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vstarck/4625881 to your computer and use it in GitHub Desktop.
Save vstarck/4625881 to your computer and use it in GitHub Desktop.
<?php
function fizzBuzz($from, $to) {
$fizzActions = array('Fizz', '', '');
$buzzActions = array('Buzz', '', '', '', '');
$text = $fizzActions[$from % 3] . $buzzActions[$from % 5];
$renderAction = array();
$renderAction[$text] = $text;
$renderAction[''] = $from;
echo $renderAction[$text] . '<br/>';
$next[$from + 1] = __FUNCTION__;
$next[$to] = 'strtolower';
call_user_func($next[$from + 1], $from + 1, $to);
}
fizzBuzz(1, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment