Home  >  Article  >  Backend Development  >  PHP variable reference An interview question about PHP variable reference

PHP variable reference An interview question about PHP variable reference

WBOY
WBOYOriginal
2016-07-29 08:43:29969browse

The php interview questions are as follows:

Copy the code The code is as follows:


$a = 1;
$x =&$a;
$b=$a++;
?>


Q:
What are the values ​​of $b and $x?
The answers to php interview questions are as follows:
$b = 1;
$x = 2;
Do you understand? If you don’t understand, think about it again. When a variable is equal to a reference to another variable, if either party changes its value, the value seen by the other party will also change. If you add it before, it will show up this time, and if you add it after, it will show up next time.

The above introduces PHP variable reference. An interview question about PHP variable reference, including PHP variable reference. I hope it will be helpful to friends who are interested in PHP tutorials.

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