An interview question about php variable reference _ PHP Tutorial

Source: Internet
Author: User
An interview question about php variable reference. Php interview questions: Copy the code as follows :? Php $ a1; $ x $ B $ a ++ ;? Q: What are the values of $ B and $ x? The answer to the php interview question is: $ b1; $ x2; do you understand? Php interview questions are as follows:

The code is as follows:


$ A = 1;
$ X = & $;
$ B = $ a ++;
?>


Q:
What are the values of $ B and $ x?

The answer to the php interview question is as follows:
$ B = 1;
$ X = 2;

Do you understand? I don't understand. think about it again. When a variable is equal to the reference of another variable, either party changes its value, and the value seen by the other party also changes. The prefix is displayed this time, and the next addition is displayed.

The pipeline code is as follows :? Php $ a = 1; $ x = $ B = $ a ++ ;? Q: What are the values of $ B and $ x? The answer to the php interview question is as follows: $ B = 1; $ x = 2; do you understand ?...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.