An interview question about php variable reference_PHP tutorial

WBOY
Release: 2016-07-21 15:34:54
Original
959 people have browsed it

The php interview questions are as follows:

Copy code The code is as follows:

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

Q:
What are the values ​​of $b and $x?

The answers to the PHP interview questions are as follows:
$b = 1;
$x = 2;

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322325.htmlTechArticlephp interview questions are as follows: Copy the code The code is as follows: ?php $a = 1; $x = $b= $a++; ? Question: What are the values ​​of $b and $x? The answers to the php interview questions are as follows: $b = 1; $x = 2; Do you understand? ...
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