We have learned the references to variables, so let's review the Knowledge:
<?php
$a = 10;
$b = &$a;
$a = 100;
echo $a.‘---------‘.$b;
?>
Instead, the parameter reference of the function points to the same position as the formal parameter and the argument. If the parameter changes in the function body, the value of the argument also changes. Let's go through the experiment to see:
<?php
$foo = 100;
//注意:在$n前面加上了&符
function demo(&$n){
$n = 10;
return $n + $n;
}
echo demo($foo).‘<br />‘;
//你会发生$foo的值变为了10
echo $foo;
?>
Using the example above, we find that the argument is F oo,in theTunewithd emoof thewhenHou,Let f o , in tune When using the D e m o wait , let Foo and Nmeanstoto thethewithaaSaveStorageAreaDomain,when N /mi> means to /mo> to The with one x save store zone field , when When the value of n is changed. Then the value of $foo is changed.
From for notes (Wiz)
Front-end PHP entry -014-parameters Reference