Student M and Student N

[article] [edit page] [discussion] [history]

From Humanitarian-FOSS Project Development Site

   <title>  Twelve Days of Christmas </title>


   * Prints title of the song

   echo "The Twelve Days Of Christmas"


  * song() function takes the associative array and places it into the lyrics
  function song(){
     * Associative array $gifts

     $gifts = array("first" => "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",
                    "nineth" => "nine ladies dancing", 
                    "tenth" => "ten lords a leaping", 
                    "eleventh" => "eleven pipers piping", 
                    "twelveth" => "twelve drummers drumming");
      * foreach loop to place the array values on the correct places in the song

      foreach($gifts as $day => $song)
        print "On the $day of Christmas, my true love gave to me $song </br>";	
   * Calls the song function which prints the song using the array


Personal tools