"Sascha Mantscheff" <[EMAIL PROTECTED]> schrieb im Newsbeitrag

> When I pass an object as a parameter to a function as "$this", this is an
> object reference (according to the docs).

it depends on the function. if you call it by value, not by reference,
then the function will contain a copy of the original not a pointer.
Doesn't matter if you call the function with $this or some other reference.
$this is a self-reference to the object. you can only use it inside the
object itself.
but as soon as you send it to a function as "by value"-parameter, a copy of
object will be used inside the function. if you call the function "by
you'll hold a pointer inside the function

> I store this reference in a local variable called $someObject. $someObject
> now contains an object pointer.

Ok, let's say the parameter is send to the functions "by reference". Then
you are
right, it'll point to the original object, but:

function (&$objRef) {
    $blah = $objRef;
-> $blah will hold a copy!

function (&$objRef) {
    $blah = &$objRef;
-> $blah will hold a reference!

> I pass $someObject to another function. Is this a reference to the
> $this, or is it a copy of the object?

Read what i wrote above and answer it yourself.

Regards Michael.

> All function calls are by value, not by reference (without the "&" name
> modifier).
> s.m.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to