Skip to content

Instantly share code, notes, and snippets.

@snipe
Last active February 6, 2022 17:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snipe/5479158 to your computer and use it in GitHub Desktop.
Save snipe/5479158 to your computer and use it in GitHub Desktop.
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