Student M and Student N

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

From Humanitarian-FOSS Project Development Site


<html>
<head>
   <title>  Twelve Days of Christmas </title>
</head>

<body>
<h1><center>


<?php
   /**
   * Prints title of the song
   */

   echo "The Twelve Days Of Christmas"
?>

</h1></center>


<center>  
<?php
   
  /**
  * 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>";	
      }
   }//song()
   
   /**
   * Calls the song function which prints the song using the array
   */
   song(); 

?>
</center>
</body>
</html>  

Personal tools