Student O and Student P

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

From Humanitarian-FOSS Project Development Site

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                      "http://www.w3.org/TR/html401/loose.dtd">
<html> 
<head>
  <meta http-equiv="Content-Type"
      content="text/html; charset=iso-8859-1">
  <title>Days of christmas!</title>
</head>
<body bgcolor="#ffffff"> 
  <h1>
  <?php
  
    $days=array(
    "first"=> "A partridge in a pear tree.",
    "second"=> "Two turtle doves and ",
    "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,",
    "twelth"=>"Twelve drummers drumming,");
                                    
     $count=0;
    foreach($days as $dayNow)
    {
        $value = $dayNow;
        $key = array_search($value, $days);
        sing($dayNow,$count,$key);
        $count++;
    }
 
    function Sing($dayItIs,$num,$key)
    {
        global $tempday;
		$tempday[12-$num]=$dayItIs; 
        print "On the $key day of Christmas, my true love sent to me:<br>"; 
   
     ksort($tempday);
        foreach ($tempday as $tempNow)
		{
            print $tempNow;
			print "<br>";
        }
	print "<br>";

    }
  ?>
  </h1>
</body>
</html>
Personal tools