php return statement

If we send information for PHP user defines function RETURN keyword is return output to calling function.

return syntax :

<?php
function functionname()
{
  ----------
  ----------
  ----------
return;
}
?>

return example :


<?php
function add_two_number($a,$b)
{
  $c=$a+$b;
  return $c;
}
$a=10;
$b=10;
echo add_two_number($a,$b);
?>

Out Put :

20

In the above example we created add_two_number function.this is used to add two number that $a,$b. That variable assigned to the numeric valus and call to add_two_number function then which store $c function and return the call function.





Content