Created
January 24, 2015 15:16
-
-
Save 0xMatt/0a70941ec42e43aefb67 to your computer and use it in GitHub Desktop.
PHP FizzBuzz
This file contains hidden or 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 header('Content-Type: text/plain'); | |
for($i = 1; $i <= 100; $i++) { | |
$string = ''; | |
$string .= ($i % 3) == 0 ? "fizz" : ''; | |
$string .= ($i % 5) == 0 ? "buzz" : ''; | |
print (empty($string)) ? $i : $string; | |
print PHP_EOL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment