Skip to content

Instantly share code, notes, and snippets.

View fabiocicerchia's full-sized avatar
🏠
Working from home

Fabio Cicerchia fabiocicerchia

🏠
Working from home
View GitHub Profile
@fabiocicerchia
fabiocicerchia / TheUnexpectedFizzBuzz.php
Last active March 10, 2020 13:54 — forked from gfabrizi/TheUnexpectedFizzBuzz.php
A different (...veeeery different) approach to the good old PHP FizzBuzz test
#!/usr/bin/env php
<?php
if ($argc !== 2 || !ctype_digit($argv[1]))
die('You must specifiy only one parameter: the max number as an integer' . PHP_EOL);
for ($input = (int) $argv[1], $i = 0; $i < $input; ) echo ([
0 => 'FizzBuzz',
3 => 'Fizz', 6 => 'Fizz', 9 => 'Fizz', 12 => 'Fizz',
5 => 'Buzz', 10 => 'Buzz',