Skip to content

Instantly share code, notes, and snippets.

@jrmadsen67
Last active May 1, 2017
Embed
What would you like to do?
Next time someone asks you to take a FizzBuzz Test...
$biggest =100;
$all_numbers = range(0,$biggest);
$threes = array_fill_keys(range(3, $biggest, 3), 'Fizz');
$fives = array_fill_keys(range(5, $biggest, 5), 'Buzz');
$fifteens = array_fill_keys(range(15, $biggest, 15), 'FizzBuzz');
$all_numbers = array_replace($all_numbers, $threes, $fives, $fifteens);
var_dump($all_numbers);
@jrmadsen67

This comment has been minimized.

Copy link
Owner Author

@jrmadsen67 jrmadsen67 commented Aug 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment