Creating a Function in PHP

Source code :

<?php
function add($val1, $val2)
{
  $sum = $val1 + $val2;
  echo "Sum of the two numbers is : $sum";
}
add(1, 2);
?>

Output :

Sum of the two numbers is : 3

Output :


                

Comments :