Student X

 /* Twelve Days ?>
 * Program writes the song "The Twelve Days of Christmas"
 * Student X
 * Student X
 * Student X

The Twelve Days of Christmas 

$day=array("first"=>"A partridge in a pear tree",	//array that holds the verse information             "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");

function sing_days($verses)	//uses a foreach loop to print the day and verses {	$i=0; $temp = array("","","","","","","","","","","",""); foreach($verses as $daynum=>$gift){ print("On the $daynum day of christmas"); print("My true love gave to me"); print("$gift"); $temp[$i] = $gift;		// adds already used verses to a new array for ($x = $i-1;$x>=0;$x--){		//prints the verses before the current day if ($x==0){ print("And " . strtolower($temp[$x]) . ""); }			else{ print("$temp[$x]"); }		}		$i++; print(""); } }

?>

 sing_days($day);	//calls the function that writes the song ?>