function parameters

Hi,
In the code below, I understand the $place variable and how it's working. What I can't understand is how I'M getting the output "he played 1, 2, etc... How is that function and the $stanza variable returning a single digit number? Thanks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



Param Old Man


Param Old Man

Demonstrates use of function parameters

<?php

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


HERE;
return $output;
} //end veruse

function chorus()
{
$output = <<<HERE
...with a knick-knack<br>
paddy-wack

give a dog a bone

this old man came rolling home




HERE;
return $output;
}// end chorus

?>


Thanks & regards
Lokananth
[url=http://www.mioot.com]Live Chat Software[/url] By miOOt
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories