Hey,
put this in thedocs somewhere?
regards,
Derick
On Wed, 9 Jun 2004, Sara Golemon wrote:
> That's true. What I left out of my explanation (in order to keep it simple)
> is that when you "copy" a variable, a new label is created to point to the
> same zval, and the zval's refcount is incrme
> I think, and I could be completely wrong, that copying a variable actually
> creates a reference. The data is only copied when the variable referenced
is
> modified.
>
That's true. What I left out of my explanation (in order to keep it simple)
is that when you "copy" a variable, a new label is c
In general, if you don't mean for it to be a reference semantically, you
are best off not using references at all. PHP will do the right thing.
Andi
At 10:32 AM 6/9/2004 +0200, Bert Slagter wrote:
Derick Rethans wrote:
On Wed, 9 Jun 2004, Stephan Schmidt wrote:
Yes, that is correct.
No, it is not
Derick Rethans wrote:
On Wed, 9 Jun 2004, Stephan Schmidt wrote:
Yes, that is correct.
No, it is not. 'copying' a variable copies the structure to contain the
variable, but not the data, but does NOT make a reference as that's a
different concept.
You are right that the data associated with a vari
On Wed, 9 Jun 2004, Stephan Schmidt wrote:
> Hi,
>
> > I think, and I could be completely wrong, that copying a
> > variable actually
> > creates a reference. The data is only copied when the
> > variable referenced is
> > modified.
> Yes, that is correct.
No, it is not. 'copying' a variable copi
Hi,
> I think, and I could be completely wrong, that copying a
> variable actually
> creates a reference. The data is only copied when the
> variable referenced is
> modified.
Yes, that is correct.
Stephan
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://w
I think, and I could be completely wrong, that copying a variable actually
creates a reference. The data is only copied when the variable referenced is
modified.
"Bert Slagter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Sara Golemon wrote:
> > Every "variable" in PHP is a pair
Sara Golemon wrote:
Every "variable" in PHP is a pair.
>
> [cut]
$foo = 1;
/*$foo (label) >1 (value) (is_ref=0, refcount=1) */
$bar = &$foo;
/* $foo (label) -->1 (value) */
/* $bar (label) ---/ is_ref=1, refcount=2 */
Hope that helps.
-Sara
Thanks fo
> As you can see the original tree now contains a pointer, how can that
> be, I didn't change the original array!?
> So what I'd like to know is: Is this intended behavior, and if so: why
> does it work like this and would it make some operations impossible?
>
The truth of it is, this was true in