|
Posted by Chung Leong on 12/08/05 04:47
ZeldorBlat wrote:
> Yeah -- I like PHP's reference model a lot, mainly for it's simplicity:
> every single "variable" is just a "label" for some value in memory.
> Creating a "reference" is really just a way of creating another label
> for that same value in that same spot in memory. Of course there are
> some rules about what is always assigned by reference and what is
> always copied.
Well, simple logic could leads to scenarios that aren't that easily
understandable. My original question arose out of this function I'm
writing, which returns a large array of arrays. Knowing that PHP's
copy-on-write mechanism creates copies when "references" are returned,
I didn't want to return a whole array-ful of them. The line $lines[] =&
$line did look like that's what being created.
Navigation:
[Reply to this message]
|