Forum Moderators: coopster
PHP References Explained [us3.php.net]
I'll be reaading that as well ;)
Birdman
It's SIMILAR to (NOT THE SAME AS) pointers in the C programming language.
Instead of passing the actual value of a function or a variable, you pass a reference to its space in memory. That way, the reference remains updated with the actual value while it changes, instead of having to update it later on.
These are the acceptable forms of pass by reference:
function &db_fetch( )
{
}
$obj =& new $className();
This is an unacceptable one and is being discouraged:
$myval = myfunc(&$arg);
The first two are ok because they're very useful and necessary; the third one is confusing and makes it difficult to read and maintain code.