Last active
August 15, 2017 15:01
-
-
Save dreanmer/9ce8f70b6312a799516e2e6939867f35 to your computer and use it in GitHub Desktop.
Fizz Buzz solution zero if
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 | |
$result = array_diff( range( 0, 100, 1 ), range( 0, 100, 3 ), range( 0, 100, 5 ) ) + | |
array_fill_keys( range( 0, 100, 15 ), 'FizzBuzz' ) + | |
array_fill_keys( range( 0, 100, 5 ), 'Buzz' ) + | |
array_fill_keys( range( 0, 100, 3 ), 'Fizz' ); | |
ksort( $result ); | |
unset( $result[ 0 ] ); | |
echo implode( "\n", $result ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment