Re: Wikimedia - php4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings wrote:
> I think you mean novice use. There are certainly times when assigning an
> object to a variable I want all the values currently referring to that
> object to see the update and not just the variable being assigned to. I
> understand that objects in PHP5 are passed by reference under normal
> assignment, but it's a copy of a reference and not a reference to a
> reference.

I am not sure I would call it novice use.  Normally you simply want to
manipulate the object itself.  As in:

class foo {
    public $prop = 1;
}
$a = new foo();
$b = $a;
$b->prop++;
echo $a->prop;

This will of course output 2.  Manipulating the object through any of
its references will be reflected in all the others as there is just one
object here.

-Rasmus

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux