We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8a95e8e + 2dc4898 commit dfcd93dCopy full SHA for dfcd93d
PHP/fizzbuzz.php
@@ -0,0 +1,29 @@
1
+<?php
2
+// PHP program to print Fizz Buzz
3
+
4
+$i;
5
+for ($i = 1; $i <= 100; $i++)
6
+{
7
+ // number divisible by 3 and
8
+ // 5 will always be divisible
9
+ // by 15, print 'FizzBuzz' in
10
+ // place of the number
11
+ if ($i % 15 == 0)
12
+ echo "FizzBuzz" . " ";
13
14
+ // number divisible by 3? print
15
+ // 'Fizz' in place of the number
16
+ else if (($i % 3) == 0)
17
+ echo "Fizz" . " ";
18
19
+ // number divisible by 5, print
20
+ // 'Buzz' in place of the number
21
+ else if (($i % 5) == 0)
22
+ echo "Buzz" . " ";
23
24
+ else // print the number
25
+ echo $i," " ;
26
+}
27
28
+// This code is contributed by m_kit
29
+?>
0 commit comments