PHP learning : Returning values - Publik Talk

Breaking

An informative website for every one.

Post Top Ad

Post Top Ad

Wednesday, August 2, 2017

PHP learning : Returning values

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:



No comments:

Post a Comment

Post Top Ad