On Jul 18, 2011 11:51 AM, "Hannes Landeholm" <landeh...@gmail.com> wrote:
> Weak references is an OOP concept. Scalar data types and arrays are not
OOP-related so I don't think that would make sense. Variable references is
not the same as object references. A variable reference is simply a variable
that is connected with another variable (if you set one it will change the
other). If two variables have the same object reference they are not
connected, if you set one variable the other is still set to the initial
object reference.
>
> Also, arays and strings have special memory handling - they use lazy
copying so it's opaque if two equal arrays/strings refer to the same region
of memory. It's unclear what construction/destruction even mean in that
sense. An array might actually have been "constructed" by the compiler. A
reference to an object instance is a "pointer" but a reference to a variable
is not.
>
> http://us.php.net/manual/en/language.references.arent.php
>
> I hope that illustrates the difference.
>
> Do you have any special use case in mind?

Nothing in particular, and I understand the differences in memory and
reference handling between objects and other variables within PHP. It just
seemed like an inconsistency, and I was curious whether it was a design or
technical decision.

I guess the answer to that is "yes". :)

Thanks,

Adam

Reply via email to