- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
<?
for ($i = 1; $i <= 100; $i++) {
$t1 = $i / 3;
$t2 = $i / 5;
if (preg_match("/\./", "$t1") == false && preg_match("/\./", "$t2") == false) {
echo "FizzBuzz<br>";
} else {
if (preg_match("/\./", "$t1") == false) {
echo "Fizz<br>";
} else {
if (preg_match("/\./", "$t2") == false) {
echo "Buzz<br>";
} else {
echo "$i<br>";
}
}
}
}
?>
guest 15.05.2015 12:53 # 0
Vindicar 15.05.2015 15:39 # +3