How to use return value and parameters in php functions

PHP

We will show you a simple example for the parameters and the return value . Return value is used to get the result of the function in the variable. Return is the key word which is needed to return the value out side the function.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Functions with return value Examples in PHP</title>
</head>
<body>
<?php
// A simple example with out the parameters

function login()
{
//You can write what ever you want to write in the function
return 'Welcome User X.';
}
$status&nbsp; = login();
echo $status;

//Function with the return value and the parameters.
//We will calculate the string lenght and then return the lenght value
function calculate($val)
{
$v = strlen($val);
return $v;
}
$total = calculate('My Name is John');

echo 'Lenght of the String is -'.$total;

?>
</body>
</html>
-->