From: "Peter C. Verhage" Date: 2007-10-03T07:18:22+09:00 Subject: Re: Reference vs. Reference Hi, In PHP 4 and 5 you have references which work similar like C++ references. E.g. you can make a variable reference another variable after which if you change the value of one of those variables the other variable's value will also be "updated". An example: $x = 1; $y = &$x; // y references x $x = 2; echo $y; // 2 $y = 3; echo $x; // 3 In PHP 4 you always had to pass objects by reference if you didn't want to end up with a copy of your object. $x = new Object(); $x->value = 1; $y = $x; // copy echo $y->value; // 1 $y->value = 2; echo $x->value; // 1 $x->value = 3; echo $y->value; // 2 $y = &$x; // reference echo $y->value; // 3 $y->value = 4; echo $x->value; // 4; $x->value = 5; echo $y->value; // 5 However, in PHP 5 they introduced a concept similar to the "references" we know in Ruby. But because they already used the term "reference" they had to come up with a different name, so they call them object handles. If you assign an object to a variable you are assigning an object handle to the variable. If you assign the value of the first variable to another variable you are assigning it the same object handle. So both variables "reference" the same object. But if you now assign another object to the first (or second) variable, only that variable's content changes. E.g. $x = new stdClass(); $y = $x; // assign object handle $x->value = 2; echo $y->value; // 2 $y->value = 3; echo $x->value; // 3 $x = new stdClass(); // assign different object handle $x->value = 1; echo $y->value; // 3 So maybe we should call them handles instead of references to clarify the difference? Regards, Peter