Re: Variables by Reference

From: Date: Mon, 31 Jul 2000 13:47:13 +0000
Subject: Re: Variables by Reference
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-9161@lists.php.net to get a copy of this message
Yep you've answered that perfectly, thanks :) Yeh mirroring probably wasn't the best word there, but thanks for that Regards, Matt Kevin Hendrix wrote: > > Hi. > > If your variable is created by reference, then both old and new variable > should point to the same location in memory, so changing one should be visible > when using the other. There is no fancy mirroring going on behind the scenes, > just a couple of variables which point to the same segment of memory. > > kevin > -- > Kevin Hendrix > Programmer - PennyPI, LLC. > khendrix@pennypi.com > http://www.pennypi.com/ > - > kevin Of yuendrikh - International Man of Mystery > > Matt wrote: > > > > Hello, i'm just wondering, if a variable is created > > by reference, does that mean that the two variables > > are mirrors of each other ? Or does that mean the > > creating variable can only change the other and > > not the other way round. > > > > Eg. > > > > $init = "hello world"; > > > > $init = &$newref; > > > > $newref = "five"; > > > > echo $newref; // echos "five"; > > echo $init; // was mirrored, echos five too > > > > This is a simple example but i'm sure you all know > > what i'm talking about, so which is it ? Mirrored > > or not ? > > > > Regards, Matt > >

« previous php.general (#9161) next »