Student K and Student L

For the result, click here For the documentation, click here

The Twelve Days of Christmas The Twelve Days of Christmas

 "a partridge in a pear tree",                 "second" => "two turtle doves",                  "third" => "three french hens",                  "fourth" => "four calling birds",                  "fifth" => "five golden rings",                  "sixth" => "six geese a-laying",                  "seventh" => "seven swans a-swimming",                  "eighth" => "eight maids a-milking",                  "ninth" => "nine ladies dancing",                  "tenth" => "ten lords a-leaping",                  "eleventh" => "eleven pipers piping",                  "twelfth" => "twelve drummers drumming");

/**   *  Define an array that will map integers to each day */

$num = array(1 => "first","second","third","fourth","fifth","sixth",                     "seventh","eighth","ninth","tenth","eleventh","twelfth");

/**   *  Prints a verse from "The Twelve Days of Christmas" *   *  This function prints a verse from the song "The Twelve Days of Christmas" *   *  @param integer $day the day * @return void */

function print_day($day) {       global $num; global $days; $verse = "On the ". $num[$day]. " day of Christmas, my true love gave to me \r\n";

for($i = $day; $i > 0; $i--) {           if(($i == 1) && ($day == 1)) {               $verse .= $days[$num[$i]]. ". \r\n"; }           else if($i == 1) {               $verse .= "and ". $days[$num[$i]]. ". \r\n"; }           else {               $verse .= $days[$num[$i]]. ", \r\n"; }       }

print($verse); }

/**   * Iterate through the array and print each day with its gift */

foreach($num as $int_day => $string_day) {       print_day($int_day); print(" \r\n\r\n"); }

?>