Questions about variable reference $ fooBob; $ bar & amp; $ foo; $ barmy & nbsp; name & nbsp; is & nbsp; $ bar; echo & nbsp; $ bar. & lt; br & gt; echo & nbsp; $ foo; this is an example in the manual. what I doubt is that I can understand the result of outputting $ bar, but why is his value not Bob when $ foo is output?
$ Foo = 'Bob ';
$ Bar = & $ foo;
$ Bar = "my name is $ bar ";
Echo $ bar .'
';
Echo $ foo;
This is an example in the manual. I have doubts that I can understand the result of outputting $ bar, but why is his value not Bob but my name is Bob when outputting $ foo, why does the value change? please explain it. thank you!
Share To: '; echo? $ Foo; this is an example in the manual. I have doubts... 'data-pics = ''>
------ Solution --------------------
This is the difference between value assignment and reference.
$ Foo = 'Bob ';
$ Bar = & $ foo; // $ bar and $ foo point to the same variable table item.
Therefore, any change to $ bar will cause $ foo changes (except deletion)
Just like a person with two names
------ Solution --------------------
Yes. the values of both variables are the same.