Re: Return Values Copied? Copied if By Reference?
| From: | Larry Garfield | Date: | Thu, 27 Jul 2006 05:35:09 +0000 |
| Subject: | Re: Return Values Copied? Copied if By Reference? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239837@lists.php.net to get a copy of this message | ||
On Wednesday 26 July 2006 21:41, Robert Cummings wrote:
> > I'm working on some code that would be called to generate a cell in a
> > possibly large table and therefore a small difference in performance
> > may have a significant impact.
>
> PHP uses copy-on-write and so copies are essentially shared until such
> time as you modify one of them. If you don't need references then copies
> are faster than references.
By the same token, then, if I have a function that generates a large string
and returns it, is there any benefit to return-by-reference?
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson