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, 1668🔥, 0💬
Popular Posts:
How To Submit Values without Using a Form in PHP? If you know the values you want to submit, you can...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...
Where to find tutorials on Using Azure API Management Publisher Dashboard? Here is a list of tutoria...
How to install "C++/CLI Support" component in Visual Studio? I need to build my Visual Studio C++/CL...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...