Skip to content

Instantly share code, notes, and snippets.

@karlmonson
Created October 7, 2015 22:06
Show Gist options
  • Save karlmonson/6fbe20e297cafbc5ca42 to your computer and use it in GitHub Desktop.
Save karlmonson/6fbe20e297cafbc5ca42 to your computer and use it in GitHub Desktop.
FizzBuzz Example
<?php
/*
* FizzBuzz Example
* Author: Karl Monson
* URL: https://github.com/karlmonson
*/
for($i = 0; $i <= 100; $i++) {
if($i % 3 == 0 && $i % 5 == 0) {
echo 'FizzBuzz';
continue;
} elseif($i % 3 == 0) {
echo 'Fizz';
continue;
} elseif($i % 5 == 0) {
echo 'Buzz';
continue;
} else {
echo $i;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment