Home>Article>Backend Development> Variable references about PHP constants and variables
The previous article introduced you to "How to use PHP to build environment variables? What other environment variables do you know?》, this article continues to introduce to you the variable references of PHP constants and variables:
About the variable references of PHP constants and variables
Write two pieces of code respectively, as shown below:
'; //$fo的结果为8 echo $fo.'
' ?>
The running result is as follows:
Second The code snippet is as follows:
'; //$fo的结果为8 echo $fo.'
' ?>
The running result is as follows:
According to the above code, it can be concluded thatWhy do both results become 6?
Reason
: In $bar = &$fo, the two of them share the same address, which means that no matter which parameter you change, their values will be changed accordingly. Change, that is, no matter how the value of $fo or $bar changes, $fo changes to $bar, and $bar changes, $fo will also change.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of Variable references about PHP constants and variables. For more information, please follow other related articles on the PHP Chinese website!