What does the & symbol in php syntax mean?
In PHP syntax, the & symbol is not used very much, but it also needs to be understood and mastered. Specifically, this single & symbol represents reference assignment
Create a new PHP document and define a variable, example:
$fruit = 'cherry';
Use the "&" symbol to create a reference variable, example:
$quote = &$fruit;
Print the values of two variables, example:
echo '$quote='.$quote; echo '<br />'; echo '$fruit='.$fruit;
Save the above content, view and print in the browser,
Modify the value of any variable and print again. The values of both variables have changed.
So the reference assignment can be understood as an alias of a variable. For example ($quote is $ Alias of fruit)
Example:
$quote = 'garpe'; echo '$quote='.$quote; echo '<br />'; echo '$fruit='.$fruit;
Save the above content and view the print preview again
Notes
Referenced and referenced variables are also called memory communities.
For more PHP knowledge, please visit PHP Chinese website!
The above is the detailed content of What does the & symbol in php syntax mean?. For more information, please follow other related articles on the PHP Chinese website!