Jump to content

Just for fun.


jonsjava

Recommended Posts

Improve the script (either by making it more complex, or more simple):

<?php
$count = 99;
while ($count > 0){
print "<pre>".$count." bottles of beer on the wall, ".$count." bottles of beer.\n
Take one down and pass it around, ".--$count." bottles of beer on the wall.\n\n";
}

print "<pre>No more bottles of beer on the wall, no more bottles of beer.\n
Go to the store and buy some more, 99 bottles of beer on the wall.";
?>

Link to comment
https://forums.phpfreaks.com/topic/113673-just-for-fun/
Share on other sites

here

<pre>
<?php
$count = 99;
while ($count > 0) {
switch($count){
	case 1:
		$bottle_1 = "bottle";
		$bottle_2 = "bottles";
		$one_it = "it";
		break;
	default :
		$bottle_1 = "bottles";
		$bottle_2 = "bottles";
		$one_it = "one";
		break;
	case 2:
		$bottle_2 = "bottle";
}
print "{$count} {$bottle_1} of beer on the wall, {$count} {$bottle_1} of beer.
Take {$one_it} down and pass it around, " . --$count . " {$bottle_2} of beer on the wall.\n\n";
}
print "<pre>No more bottles of beer on the wall, no more bottles of beer.\n
Go to the store and buy some more, 99 bottles of beer on the wall.";
?>
</pre>

 

Scott.

Link to comment
https://forums.phpfreaks.com/topic/113673-just-for-fun/#findComment-584176
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.