PHP Programing language

How can returning References from Function
Previous Home Next
Function can also return references in PHP. the references are interesting items in PHP. For example, say that you had a variable named $value; you could get a references to that variable with the reference operator:


$ref = & value;

<title>Returning references from Functions  </title>
<h1>Returning references from Functions </h1>
$value = 4;
echo "Current value:", $value, "\n";
$ref = &return_reference ($value);
echo "New value:", $value, "\n";
function &return_reference (& $ref)
return $ref;



Previous Home Next