Created
February 19, 2014 23:01
-
-
Save ryanorsinger/0634784629a6e8b49571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$i = 99; | |
while ($i >= 0) { | |
$j = $i - 1; | |
echo "$i bottles of beer on the wall. $i bottles of beer!\n"; | |
echo "We take one down and pass it around, $j bottles of beer on the wall!" . PHP_EOL; | |
$i -= 1; | |
if ($i == 2) { | |
echo "$i bottles of beer on the wall. $i bottles of beer!\n"; | |
echo "We take one down and we pass it around, 1 last bottle of beer on the wall!\n"; | |
$i -= 1; | |
} else if ($i == 1) { | |
echo "$i bottle of beer on the wall. $i bottle of beer.\n"; | |
echo "We take one down and we pass it around, no more bottles of beer on the wall\n"; | |
$i -= 1; | |
} else if ($i == 0) { | |
echo "No more bottles of beer on the wall, no more bottles of beer. Go to the store and buy some more, 99 bottles of beer on the wall." . PHP_EOL; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment