Re: HOWTO: &new notation OR Copy-by-Value
| From: | marko | Date: | Fri, 23 May 2003 13:11:49 +0000 |
| Subject: | Re: HOWTO: &new notation OR Copy-by-Value | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5571@lists.php.net to get a copy of this message | ||
Hi Ulf,
> > pointer = new Object();
> PHP does not offer pointers. It's references you're talking about.
That's clear, was just my variable name. :)
> 'This is because "new" does not return a reference by default, instead
> it returns a copy.
yes, in ZE1. Not so in ZE2.
> Note: There is no performance loss (since PHP 4 and up use
> reference counting) returning copies instead of references. On the
ok
> copies virtually takes no time (unless none of them is a large array or
> object and one of them gets changed and the other(s) one(s)
> subsequently, then it would be wise to use references to change them all
> concurrently). '
right, that might be the case quite often though.
> Well, I'd prefer wasting my time on a sunny balcony instead of modifing
> tons of existing code and turn all changes back as soon as PHP 5 on the
> horizon.
I see. I got the message! ;)
Ciao,
Marko