Write a PHP Program to calculate sum of given number



Write a PHP Program to calculate sum of given number.

<!DOCTYPE html>
<html>
<head>
        <title>Practical-4</title>
</head>
<body>
<?php
$val1=10;
$val2=10;
function sum($val1,$val2)
{
        $total=$val1+$val2;
        return $total;
}
echo "<b>Sum Using Function:</b>".sum($val1,$val2);
$sum=$val1+$val2;
echo "</br>";
echo "<b>Sum is :</b>$sum";
?>
</body>
</html>

OUTPUT:-

Sum Using Function:20
Sum is :20

Comments