Copy code The code is as follows:
$foo = 'Bob'; // Assign 'Bob' give $foo
$bar = &$foo; // reference $foo via $bar
echo $foo.'
';
$bar = "My name is $bar" ; // Modify the $bar variable
echo $bar.'
';
echo $foo.'
'; // The value of $foo is also modified
?>
Output:
Bob
My name is Bob
My name is Bob
We see that the original value was indeed modified, which happened after the reference After being assigned, but before being assigned, the original variable will not change.
http://www.bkjia.com/PHPjc/325218.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325218.htmlTechArticleCopy the code as follows: ?php $foo = 'Bob'; // Assign 'Bob' to $foo $bar = // Reference $foo through $bar echo $foo.'br/'; $bar = "My name is $bar"; // Modify the $bar variable echo $bar....