Monday, March 26, 2007

return a reference from a function

To return a reference from a function, you have to use the reference operator & in both the function declaration and when assigning the returned value to a variable:

Example 17-13. Returning a reference from a function


<?php
function &returns_reference()
{
return $someref;
}

$newref =& returns_reference();
?>

No comments :