Skip to content

Instantly share code, notes, and snippets.

@DArcMattr
Created November 10, 2015 23:10
Show Gist options
  • Save DArcMattr/ce26997f1460f480f229 to your computer and use it in GitHub Desktop.
Save DArcMattr/ce26997f1460f480f229 to your computer and use it in GitHub Desktop.
#!/usr/bin/php
<?php // vim:ft=php
$max = intval( $argv[1] );
for ( $i = 1; $i <= $max; $i++ ) {
$string = '';
$string .= ( 0 === ( $i % 3 ) ) ? 'Fizz' : '';
$string .= ( 0 === ( $i % 5 ) ) ? 'Buzz' : '';
$string .= ( 0 === ( $i % 7 ) ) ? 'Baz' : '';
$string .= ( '' === $string ) ? strval( $i) : '';
echo $string . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment