Skip to content

Instantly share code, notes, and snippets.

@svenluijten
Last active November 19, 2015 13:15
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 svenluijten/72883fbaa70eb89f5a3b to your computer and use it in GitHub Desktop.
Save svenluijten/72883fbaa70eb89f5a3b to your computer and use it in GitHub Desktop.
<!-- 99 bottles of beer song in 251 bytes. -->
<?php for($i=99;$i>0;$i--){$b=" of beer";$s=" bottles$b";$r=" bottle$b";$w=" on the wall";$h=$i-1;echo$h>=1?"$i$s$w, $i$s.\nTake one down and pass it around, $h".($h<2?$r:$s)."$w.\n\n":"$i$r$w, $i$r. \nGo to the store and buy some more, 99$s$w.\n\n";}
<?php
// The unminified version.
for ($i=99; $i > 0; $i--) {
$b = " of beer";
$s = " bottles$b";
$r = " bottle$b";
$w = " on the wall";
$h = $i - 1;
echo $h >= 1 ? "$i$s$w, $i$s.\nTake one down and pass it around, $h" . ($h<2 ? $r : $s) . "$w.\n\n" : "$i$r$w, $i$r. \nGo to the store and buy some more, 99$s$w. \n\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment