Returns a value to the caller.
Functions and scripts included with the include() or require() functions can return a value to the caller using the return statement. The use of return means that the execution of the script or function stops.
<?php
function formatText($s) {
$s = "<b><i>" . $s . "</b></i>";
return $s;
}
$text = "Some random text";
$text = formatText($text);
print htmlSpecialChars($text);
?>
<b><i>Some random text</b></i>
A function that formats text is defined. It adds some html tags to a string and returns the result in a return statement.