Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How Values Are Returned from Functions
How Values Are Returned from Functions? - PHP Script Tips - Creating Your Own Functions
✍: FYIcenter.com
If a value is returned from a function, it is returned by value, not by reference. That means that a copy of the value is return. Here is a PHP script on how values are returned from a function:
<?php
$favor = "vbulletin";
function getFavor() {
global $favor;
return $favor;
}
$myFavor = getFavor();
print("Favorite tool: $myFavor\n");
$favor = "phpbb";
print("Favorite tool: $myFavor\n");
?>
This script will print:
Favorite tool: vbulletin Favorite tool: vbulletin
As you can see, changing the value in $favor does not affect $myFavor. This proves that the function returns a new copy of $favor.
2007-04-24, 4915👍, 0💬
Popular Posts:
What are the core functionalities in XML .NET framework? Can you explain in detail those functionali...
What is a measure in OLAP ? Measures are the key performance indicator that you want to evaluate. To...
How To Concatenate Two Character Strings? - MySQL FAQs - Introduction to SQL Basics If you want conc...
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...
What is the concept of XPOINTER? XPOINTER is used to locate data within XML document. XPOINTER can p...