Tools, FAQ, Tutorials:
Returning a Value from a Function in PHP
How To Return a Value Back to the Function Caller? in PHP?
✍: FYIcenter.com
You can return a value to the function caller by using the "return $value" statement. Execution control will be transferred to the caller immediately after the return statement. If there are other statements in the function after the return statement, they will not be executed. Here is a PHP script example on how to return values:
<?php
function getYear() {
$year = date("Y");
return $year;
}
print("This year is: ".getYear()."\n");
?>
This script will print:
This year is: 2006
⇒ Passing an Argument to a Function in PHP
⇐ Invoking a User Function in PHP
2016-12-24, ∼2537🔥, 0💬
Popular Posts:
What is EPUB 2.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 2.0 Metadata "dc:publisher" ...
Tools, FAQ, Tutorials: JSON Validator JSON-XML Converter XML-JSON Converter JSON FAQ/Tutorials Pytho...
What is EPUB 3.0 Metadata "dc:description" Element? EPUB 3.0 Metadata "dc:description" is an optiona...
How to access Query String parameters from "context.Request.Url.Que ry"object in Azure API Policy? Q...
Where to find tutorials on HTML language? I want to know how to learn HTML. Here is a large collecti...