05-07-2009, 12:29 AM
|
#12 (permalink)
|
|
The Gregarious
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
|
Ok, I read it and I believe I do get it, but it seems to explain one scenario.
PHP Code:
$szVar1 = 'TalkPHP.com';
$szVar2 = 'WiredFlame.com';
$szVar1 =& $szVar2;
Output:
szVar1 is: WiredFlame.com
szVar2 is: WiredFlame.com
But according to what WH said, if you change $szVar1 after the fact, like this:
PHP Code:
$szVar1 = 'TalkPHP.com';
$szVar2 = 'WiredFlame.com';
$szVar1 =& $szVar2;
$szVar1 = 'TalkPHP.com';
You get this:
szVar1 is: TalkPHP.com
szVar2 is: TalkPHP.com
So I can see how if Var1 is referencing Var2, and you change Var2, and you print Var1, it will reveal the new value that was set on Var2...
I just don't understand why in the second code, how is it possible for Var1 to reference through Var2, then you change Var1 in the last line, and then Var2 changes!!!
|
|
|
|