View Single Post
Old 05-15-2009, 12:27 PM   #20 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Just passed a little time during lunch.

PHP Code:
<?php
function a($n){$a=$n%100or$a='no more';return
sprintf("%s bottle%s of beer",$a,(--$n)?'s':'');}
for (
$w=' on the wall',$n=100;1+$s=a($n);)
    echo 
ucfirst($s),$w,', ',$s,".\n",$n?
    
'Take one down and pass it around, '
    
:'Go to the store and buy some more, ',
    
a($n--?$n:99),$w,'.',"\n\n";
Salathe is offline  
Reply With Quote