Description:
Following example takes two integer parameters and add them together and then returns their sum to the calling program.
Note that return keyword is used to return a value from a function.
Code:
<?php
function add($x,$y)
{
$total =$x+$y;
return $total;
}
$return_value =add(10,20);
echo "Returned value from the function :$return_value";
?>
Output:
Following example takes two integer parameters and add them together and then returns their sum to the calling program.
Note that return keyword is used to return a value from a function.
Code:
<?php
function add($x,$y)
{
$total =$x+$y;
return $total;
}
$return_value =add(10,20);
echo "Returned value from the function :$return_value";
?>
Output:
No comments:
Post a Comment