Skip to content

Instantly share code, notes, and snippets.

@uyab
Created March 17, 2017 07:05
Show Gist options
  • Save uyab/6dd65e08abd7fa797e4352f327621321 to your computer and use it in GitHub Desktop.
Save uyab/6dd65e08abd7fa797e4352f327621321 to your computer and use it in GitHub Desktop.
FizzBuzz memakai PHP
<?php
foreach (range(1, 100) as $i) {
$msg = '';
if($i % 3 == 0) {
$msg .= 'Fizz';
}
if($i % 5 == 0) {
$msg .= 'Buzz';
}
if($msg) {
$i = $msg;
}
echo $i.'<br>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment