Created
March 6, 2012 23:51
-
-
Save mattonomics/1989872 to your computer and use it in GitHub Desktop.
Dummy Test
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 | |
/* | |
Count from 1-100. If the number is divisible by 3 & 5, output "FizzBuzz". | |
If divisible by 3 but not 5, output "Fizz". | |
If divisible by 5 but not 3, output "Buzz". | |
Otherwise output the number. | |
*/ | |
function loop_it() { | |
$out = ''; | |
for($i = 1; $i <= 100; $i++) | |
$out .= is_int($i / 3) ? (is_int($i / 5) ? "FizzBuzz " : "Fizz ") : (is_int($i / 5) ? "Buzz " : "$i "); | |
return $out; | |
} | |
echo loop_it(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment