Tools, FAQ, Tutorials:
Returning a Reference from a Function in PHP
How To Return a Reference from a Function? in PHP?
✍: FYIcenter.com
To return a reference from a function, you need to:
Here is a PHP script on how to return a reference from a function:
<?php
$favor = "vbulletin";
function &getFavorRef() {
global $favor;
return $favor;
}
$myFavor = &getFavorRef();
print("Favorite tool: $myFavor\n");
$favor = "phpbb";
print("Favorite tool: $myFavor\n");
?>
This script will print:
Favorite tool: vbulletin Favorite tool: phpbb
As you can see, changing the value in $favor does affect $myFavor, because $myFavor is a reference to $favor.
⇒ Specifying Argument Default Values in PHP
⇐ Function Returns Data by Value in PHP
2016-12-08, ∼2442🔥, 0💬
Popular Posts:
What is Azure API Management Developer Portal Admin? The Developer Portal Admin is an Azure Web port...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How to login to Azure API Management Publisher Dashboard? If you have given access permission to an ...
How To Change Text Fonts for Some Parts of a Paragraph? If you want to change text fonts or colors f...
How to use the "rewrite-uri" Policy Statement for an Azure API service operation? The "rewrite-uri" ...