php refers to the problem of changing the value of a variable
- 2020-05-16 06:27:44
- OfStack
<?php
$foo = 'Bob'; // will 'Bob' Assigned to $foo
$bar = &$foo; // through $bar reference $foo
echo $foo.'<br/>';
$bar = "My name is $bar"; // Modify the $bar variable
echo $bar.'<br/>';
echo $foo.'<br/>'; // $foo The value of
?>
Output:
Bob
My name is Bob
My name is Bob
We see that the original value does change, after the reference and the assignment, but before the assignment the original variable does not change