All pastes #218953 Raw Edit

Someone

public text v1 · immutable
#218953 ·published 2006-10-24 13:02 UTC
rendered paste body

<body>
<h1>Param Old Man </h1>
<h3>Demonstrates use of function parameters</h3>
<?
 print verse(1);
 print chorus();
 print verse(2);
 print chorus();
 print verse(3);
 print chorus();
 print verse(4);
 print chorus();
function verse($stanza) {
switch ($stanza) {
case 1:
$place = “thumb”;
break;
case 2:
$place = “shoe”;
break;
case 3:
$place = “knee”;
break;
case 4:
$place = “door”;
break;
default:
$place = “I don’t know where”;
} // end switch

 $output = <<<HERE
 This old man, he played $stanza<br>
 He played knick-knack on my $place<br><br>
 HERE;
 return $output;
 } // end verse

 function chorus() {
 $output = <<<HERE
 ...with a knick-knack<br>
 paddy-whack<br>
 give a dog a bone<br>
 this old man came rolling home<br>
 <br><br>
 HERE;
 return $output;
} // end chorus
?>