3v4l.org

run code in 200+ PHP versions simultaneously
<?php class FizzBuzz { public function __call($n, $args) { return [0b10=>@Fizz,0b01=>@Buzz,0b11=>@FizzBuzz][(!($n%3)<<1)|!($n%5)]??$n; } } $fb = new FizzBuzz; var_dump($fb->{"0"}()); var_dump($fb->{"1"}()); var_dump($fb->{"2"}()); var_dump($fb->{"3"}()); var_dump($fb->{"4"}()); var_dump($fb->{"5"}()); var_dump($fb->{"6"}()); var_dump($fb->{"7"}()); var_dump($fb->{"8"}()); var_dump($fb->{"9"}()); var_dump($fb->{"10"}());
based on 5h9Wg
Output for 7.1.25 - 7.4.0rc2
string(8) "FizzBuzz" string(1) "1" string(1) "2" string(4) "Fizz" string(1) "4" string(4) "Buzz" string(4) "Fizz" string(1) "7" string(1) "8" string(4) "Fizz" string(4) "Buzz"