这个PHP代码有什么问题

Cas*_*ynn 0 html php

由于某种原因,这个PHP代码不会回应.我似乎无法弄清楚为什么.

<?php
function prob1(){
    $sum1 = 0;
    for($i=1; $i<11; $i++){
        $sum1 = $sum1 + $i; 
    }
    echo "Sum of numbers 1 - 10 is:". $sum1;
}
prob1();
?>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

UPDATE: Here is the entire web page that it exists in.
<html>
<head><title>Lab 13</title></head>
<body>

<h1>Problem 1:</h1>

<?php
function prob1(){
    $sum1 = 0;
    for($i=1; $i<11; $i++){
        $sum1 = $sum1 + $i; 
    }
    echo "Sum of numbers 1 - 10 is:". $sum1;
}
prob1();
?>

<p>
A. This is a server-side program. The code is executed on a web server and the results are returned to the user as HTML.
<br />
B. You can use javascript to accomplish the same calculation. Javascript code is executed client-side; meaning the user's machine will execute the code and return the result.
<br />
C. There is no need to use PHP in a scenario like this. Calculations such as these are more efficiently executed client-side.
<br />
</p>

<h1>Problem 2</h1>

<?php

function prob2($x){
$y = 0;

if ($x<5)
{
    $y = pow($x, 3) + 5*($x, 2) + 3;
}
else
{
    $y = pow($x, 3) - 9*pow($x, 2) + 12;
}   

echo "For X=" . $x . " Y=" + $y;
}

prob2(3);
prob2(8);

?>

<p>A. Yes, you can write the same code using javascript. In this situation, it wouldn't be necessary to use php unless you wanted to hide the calculation from the user.</p>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Ed *_*net 6

呃,你想要数字1到10的总和,但你要循环16次.

    <?php
     function prob1(){
       $sum1 = 0;
       for($i=1; $i<=10; $i++){
          $sum1 += $i; 
       }
       echo "Sum of numbers 1 - 10 is:". $sum1;
     }
     prob1();
?>
Run Code Online (Sandbox Code Playgroud)