What does the & symbol in php syntax mean?

藏色散人
Release: 2023-02-25 20:58:01
Original
6908 people have browsed it

What does the & symbol in php syntax mean?

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';
Copy after login

What does the & symbol in php syntax mean?

Use the "&" symbol to create a reference variable, example:

$quote = &$fruit;
Copy after login

What does the & symbol in php syntax mean?

Print the values ​​​​of two variables, example:

echo '$quote='.$quote;
echo &#39;<br />&#39;;
echo &#39;$fruit=&#39;.$fruit;
Copy after login

What does the & symbol in php syntax mean?

Save the above content, view and print in the browser,

What does the & symbol in php syntax mean?

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 &#39;$quote=&#39;.$quote;
echo &#39;<br />&#39;;
echo &#39;$fruit=&#39;.$fruit;
Copy after login

What does the & symbol in php syntax mean?

Save the above content and view the print preview again

What does the & symbol in php syntax mean?

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template