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, ∼2151🔥, 0💬
Popular Posts:
What are the differences of Differences of evaluateTransaction() and submitTransaction() of the fabr...
How to send an FTP request with the urllib.request.urlopen() function? If an FTP server supports ano...
What properties and functions are supported on http.client.HTTPResponse objects? If you get an http....
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
How to create a navigation file like navigation.xhtml for an EPUB 3.0 book? At least one navigation ...