tiestok
Новичок
Неразбериха с функциями, помогите!
<html><head>
<title> каук </title>
</head>
<body>
<h1> This old man </h1>
<h3> Демонстация функций </h3>
<?
verse1();
chorus();
verse2();
chorus();
function verse1() {
print <<<HERE
Thi old man, he played 1 <br>
He played knick knack on my thumb <br><br>
HERE;
} // завершение verse1
function verse2() {
print <<<HERE
This old man he played 2 <br>
He played knick knack on my choe <br><br>
HERE;
} // завершение verse2
function chorus(){
print <<<HERE
...width a knick knack <br>
giva a dog a bone <br>
thi old man came rolling home <br> <br><br>
HERE;
} //завершение chorus
?>
</body>
</html>
<html>
<head> <title> Param old man </title>
</head>
<body>
<h1> Param old man </h1>
<h3> Demonstrates use of 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 not know where";
}// завершение Switch
$output =<<<HERE
This old man, he played $stanza <br>
He played knick knack on my $place <br><br>
HERE;
return $output
}// завершение verse
function chorus () {
$output =<<<HERE
..with a knick knack<br>
paddy erve <br>
dljskvj <br>
wfnwkjfnwjfnn owfnwejonf kjfnwe <br><br><br>
HERE;
return $output
} // завершение chorus
?>
</body>
</html>
в обоих примерах ошибка указывается на последнюю строку, к примеру
Parse error: parse error, unexpected $end in C:\Program Files\Apache Group\Apache2\htdocs\Param.php on line 51
<html><head>
<title> каук </title>
</head>
<body>
<h1> This old man </h1>
<h3> Демонстация функций </h3>
<?
verse1();
chorus();
verse2();
chorus();
function verse1() {
print <<<HERE
Thi old man, he played 1 <br>
He played knick knack on my thumb <br><br>
HERE;
} // завершение verse1
function verse2() {
print <<<HERE
This old man he played 2 <br>
He played knick knack on my choe <br><br>
HERE;
} // завершение verse2
function chorus(){
print <<<HERE
...width a knick knack <br>
giva a dog a bone <br>
thi old man came rolling home <br> <br><br>
HERE;
} //завершение chorus
?>
</body>
</html>
<html>
<head> <title> Param old man </title>
</head>
<body>
<h1> Param old man </h1>
<h3> Demonstrates use of 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 not know where";
}// завершение Switch
$output =<<<HERE
This old man, he played $stanza <br>
He played knick knack on my $place <br><br>
HERE;
return $output
}// завершение verse
function chorus () {
$output =<<<HERE
..with a knick knack<br>
paddy erve <br>
dljskvj <br>
wfnwkjfnwjfnn owfnwejonf kjfnwe <br><br><br>
HERE;
return $output
} // завершение chorus
?>
</body>
</html>
в обоих примерах ошибка указывается на последнюю строку, к примеру
Parse error: parse error, unexpected $end in C:\Program Files\Apache Group\Apache2\htdocs\Param.php on line 51

