Skip to content

Instantly share code, notes, and snippets.

@snipe snipe/fizzbuzz

Last active Dec 16, 2015
What would you like to do?
By request, a PHP fizzbuzz that prints the numbers from 1 to 100. But for multiples of three print “Fuck You” instead of the number and for the multiples of five print “Choke on a Bag of Dicks”. For numbers which are multiples of both three and five print “Fuck You Choke on a Bag of Dicks”.
foreach (range(1,100) as $i)
echo (''==($x=($i%3==0?"Fuck You ":"").($i%5==0?"Choke on a Bag of Dicks":""))?$i:$x)."\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.