Difference between parsing variable and parsing reference
I found an interesting code when I’m coding.
what is difference between :
$_fx = &$a ;
with
$_fx = $a ;
The first one, we call it parsing reference, and the second one , is parsing value.
you can see the difference with this sample :
<?</code></code>
<code><code> </code>
<code>echo "without reference: <BR>";
$a = 5;
$b = $a;
echo " a : 5<BR>";
echo '$b = $a <BR>';
echo "${b} = ${a} <BR>";
for($i=1;$i<5;$i++){
$b++;
echo "a(${a}) | b(${b}) <BR>";
}
echo "<BR><BR>";
echo "with reference (&amp;amp;) : <br>";
$a = 5;
$b = &amp;amp;$a;
echo " a : 5<BR>";
echo '$b = &amp;amp;$a <BR>';
echo "${b} = ${a} <BR>";
for($i=1;$i<5;$i++){
$b++;
echo "a(${a}) | b(${b}) <BR>";
}
?>
</code>
</code>
<code><code>
as you can see, using ‘&’ , the value of $a is also changed .
so what I get is , if you using a reference, any changes you made on the reference variable ($b) will efect the real variable ($a)

