99 Bottles of Beer on the Wall
Thursday, 17. April 2008 | Autor: Michael
Gerade hatte ich Lust etwas ganz einfaches in PHP zu programmieren.
Vor ungefähr 3 Stunden bin ich auf den Wikipedia-Artikel gestossen: http://en.wikipedia.org/wiki/99_Bottles_of_Beer
Das ist ziemlich einfach umzusetzen in PHP. Das Skript gibt Jede Strophe dieses Liedes aus. Optional kann es noch erweitert werden, damit es nach der letzten Strophe wieder beginnt hoch zu zählen..
Hier der Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php $i = 99; while($i > 0) { echo "$i bottles of beer on the wall, $i bottles of beer.<br /> Take one down and pass it around, ".($i-1)." bottles of beer on the wall. <br /><br />"; $i--; } echo "No more bottles of beer on the wall, no more bottles of beer.<br /> Go to the store and buy some more, 99 bottles of beer on the wall."; ?> |
Und so sieht es dann aus: Zur Beispielseite .
Keine Ahnung, wieso ich das gemacht habe. Wahrscheinlich war mir nur gerade langweilig.. *g*
Kategorie: Allgemein, Computer, Privat | 1 Kommentar


