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?

~Hannes

On 18 July 2011 20:12, Adam Harvey <ahar...@php.net> wrote:
>
> This may just be Monday morning fuzziness, or I've just missed something in
> the RFC, but is there a reason weak references would be limited solely to
> objects, rather than any variable that can be dealt with by-reference?
>
> Thanks,
>
> Adam
>

Reply via email to