3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*The task is to print out numbers 1 through 100 but for multiples of 3 print out “Fizz” instead of the number and for multiples of 5 print “Buzz” instead. If the number happens to be divisble by both 3 and 5 print out “FizzBuzz” instead of the number.*/ for ($i = 1; $i <= 100; $i++) { $var = ($i % 3 === 0) ? "Buzz" : (($i % 5 === 0) ? "Fizz" : $i); if ($i % 3 === 0 && $i % 5 === 0) { $var = "FizzBuzz"; } echo $var, PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
1 2 Buzz 4 Fizz Buzz 7 8 Buzz Fizz 11 Buzz 13 14 FizzBuzz 16 17 Buzz 19 Fizz Buzz 22 23 Buzz Fizz 26 Buzz 28 29 FizzBuzz 31 32 Buzz 34 Fizz Buzz 37 38 Buzz Fizz 41 Buzz 43 44 FizzBuzz 46 47 Buzz 49 Fizz Buzz 52 53 Buzz Fizz 56 Buzz 58 59 FizzBuzz 61 62 Buzz 64 Fizz Buzz 67 68 Buzz Fizz 71 Buzz 73 74 FizzBuzz 76 77 Buzz 79 Fizz Buzz 82 83 Buzz Fizz 86 Buzz 88 89 FizzBuzz 91 92 Buzz 94 Fizz Buzz 97 98 Buzz Fizz

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.71 ms | 402 KiB | 8 Q