Skip to content

Instantly share code, notes, and snippets.

@adhocore
Created December 8, 2013 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adhocore/7859738 to your computer and use it in GitHub Desktop.
Save adhocore/7859738 to your computer and use it in GitHub Desktop.
Fizzbuzz implementation in PHP with minimal codes
<?php
// PHP fizzbuzz implementation by Jitendra Adhikari
// see: http://content.codersdojo.org/code-kata-catalogue/fizz-buzz/
//
// if you have shorter/smarter ways out, please fork or comment...
echo implode('<br/>', array_map(function($d){
return ($d%15==0)?'fizzbuzz':($d%5==0?'buzz':($d%3==0?'fizz':$d));
}, range(1,100)));
@adhocore
Copy link
Author

yup, thought of that before; btw, it just makes code short in span not in terms of byte, because for removing ==0 from $d%15==0, we again need some 3 extra chars !() as such !($d%15), so i dint really wrote that way for sake of readability and straight forward code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment