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++) { $Fizz = ($i % 3 === 0); $Buzz = ($i % 5 === 0); $FizzBuzz = ($Fizz === true && $Buzz === true); foreach (array_splice(get_defined_vars(), 0, 2) as $key => $var) { var_dump($var); } die; echo $var, PHP_EOL; }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Notice: Only variables should be passed by reference in /in/AA2qo on line 11 array(0) { } array(0) { }
Output for 7.3.32 - 7.3.33
array(0) { } array(0) { }
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/AA2qo on line 11 array(0) { } array(0) { }

preferences:
211.77 ms | 402 KiB | 271 Q