A & quot; heterogeneous & quot; syntax in php: $ a & amp; $ B = $ c;, php heterogeneous _ PHP Tutorial

Source: Internet
Author: User
& Amp; quot; heterogeneous & amp; quot; syntax: $ a & amp; $ B $ c; in php. A heterogeneous syntax in php: $ a $ B $ c;, a heterogeneous syntax in php: $ a $ B $ c; $ a1; $ b2; $ c3; $ a $ B $ c; echoa: $ a; echob: $ B; echoc: $ c; this is a "heterogeneous" syntax in a: 1b php: $ a & $ B = $ c;, php heterogeneous
A "heterogeneous" syntax in php: $ a & $ B = $ c;
$ A = 1;
$ B = 2;
$ C = 3;
$ A & $ B = $ c;
Echo "a: $ ";
Echo "B: $ B ";
Echo "c: $ c ";
In this case
A: 1
B: 3
C: 3
$ A = 0;
$ B = 2;
$ C = 3;
$ A & $ B = $ c;
Echo "a: $ ";
Echo "B: $ B ";
Echo "c: $ c ";
In this case
A: 0
B: 2
C: 3 resolution: 1: & the priority of the value assignment operator "=" is & the priority is high, however, in the red writing method, not $ a and $ B are first computed and then = $ c. This understanding is equivalent to 1 = $ c, 1 = $ c is incorrect. 2: The correct way to understand this alternative method is: if ($ a) {$ B = $ c }, that is, if $ a is true, the value assignment statement $ B = $ c is executed; otherwise, the value assignment statement is not executed, which is not hard to understand.

Syntax $ a $ B = $ c;, a "heterogeneous" syntax in php's heterogeneous php: $ a $ B = $ c; $ a = 1; $ B = 2; $ c = 3; $ a $ B = $ c; echo "a: $ a"; echo "B: $ B"; echo "c: $ c "; this is a: 1 B...

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.