Example
Return a value from a function:
html
<?php
function add1($x) {
return $x + 1;
}
echo "5 + 1 is " . add1(5);
?>
Definition and Usage
The return keyword ends a function and, optionally, uses the result of an expression as the return value of the function.
If return is used outside of a function, it stops PHP code in the file from running. If the file was included using include, include_once, require or require_once, the result of the expression is used as the return value of the include statements.