'; echo $foo.'
'"/> '; echo $foo.'
'">

Home >Backend Development >PHP Tutorial >The problem of changing the variable value of the address of the Employment Guidance Center for College and Technical Secondary School Graduates in Tianjin in PHP reference address

The problem of changing the variable value of the address of the Employment Guidance Center for College and Technical Secondary School Graduates in Tianjin in PHP reference address

WBOY
WBOYOriginal
2016-07-29 08:48:201137browse

Copy the code The code is as follows:


$foo = 'Bob'; // Assign 'Bob' to $foo
$bar = &$foo; // Reference $ through $bar foo
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 is indeed modified , occurs after the reference and assignment, but before the assignment, the original variable will not change

The above introduces the problem of changing the variable value of the address of the Tianjin College and Vocational School Graduates Employment Guidance Center in PHP, including the address of the Tianjin College and Vocational School Graduates Employment Guidance Center. I hope that friends who are interested in PHP tutorials can helped.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn