PHP Wysardry
PHP Manual

PHP documentation.



Home / PHP / Manual / ...



PHP Manual
Prev Chapter 14. References Explained Next

What References Are Not

As said before, references aren't pointers. That means, the following construct won't do what you expect:

function foo (∓$var)
{
    $var =∓ $GLOBALS["baz"];
}
foo($bar);

What happens is that $var in foo will be bound with $bar in caller, but then it will be re-bound with $GLOBALS["baz"]. There's no way to bind $bar in the calling scope to something else using the reference mechanism, since $bar is not available in the function foo (it is represented by $var, but $var has only variable contents and not name-to-value binding in the calling symbol table).


Prev Manual Home Next
What References Do Up Passing by Reference
Site Menu

Amazon.ca
Amazon.com
Amazon.co.uk



Most recently updated on 11 May, 2003

Home / PHP / Manual / ...



Please feel free to contact us with any comments or suggestions
PHP Manual
PHP Wysardry

This site is hosted by Spaceports