I am trying to figure out the difference between $a=&$b and $a=$b.
I know & make the variable to be a reference variable. But the following test gave me the same result. Can anyone explain the difference? Thanks.
$a=5;
$b=6;
$a=&$b;
echo $a; //6
$a=5;
$b=6;
$a=$b;
echo $a; //6
First of all: you’ll hardly ever need references, avoid the confusion of using them if you can.