Common variables:
$name = "10";
Variable variable:
1)
$a = "10"; From the first line, assign 10 to $ A;
$b = "20"; The second line, said to give 20 to $b;
$a = $b; The third line, the value of the variable $b is assigned to $ A;
Output, you can see that the value of $ A has changed to 20.
2)
$a = "10"; From the first line, assign 10 to $ A;
$a = $b; The second line indicates that the value of the $b is assigned to $ A. This is because the previous line does not give $b value, so the value of $ A is unknown, the program executes to this line, the value of $a has been set to unknown, is no longer 10
$b = "20"; In the third line, the 20 is assigned to the $b. Since the program does not go back, the value of $ A will not change at this time.
Output $ A and $b, you can see a $ A output is blank, no data ...
As can be seen above, PHP implementation is very strict!
Reference variable:
$a = "10"; Assigns 10 to the variable $ A
$a =& $b; Represents $ A Gets the address to $b. The address of $ A now is the same as the address of $b
$b = "50"; To assign 50 to $b.
The output shows that both the $a and $b values are 50
PHP variable Usage