
illustrate
1. References in PHP are not pointers. Two variables are allowed to point to the same content.
2. If a variable with a reference is assigned a value in the foreach statement, the referenced object is also changed.
Example
<?php
function test(&$b)
{
$c = 2;
$b = & $c;
// Guess whether the output here is 1 or 2?
var_dump($a);
}
$a = 1;
test($a);
// Guess whether the output here is 1 or 2?
var_dump($a);The above are the notes on the use of php references. I hope it will be helpful to everyone.