4. Increasing/Decreasing Operators (5)

Source: Internet
Author: User
Learning objective: to understand increment and decrease (++ --). <? PHP $ A = 5; $ B = $ A ++; // 1. Return its own value. 2. Add a value to 1. Analysis: the first value of $ A is 5. When $ B is reached, the value $ A ++ first returns 5 to $ B, so the value of $ B is 5. Later, the second change occurs. $ A will add 1 to it, change the original value, and finally get the new value 6. The same is true for other calculations. Var_dump ($ A, $ B); // 6 5 // * $ A --, -- $ A you can try it yourself. $ A = 3; $ B = ++ $ A; // 1. Add the value to 1 first. 2. Return the new value. Var_dump ($ A, $ B); // 4 4?> * You can add or subtract a new value as long as the symbol is in front of the variable. After the symbol is placed, it is to first return its own value, plus or minus.

4. Increasing/Decreasing Operators (5)

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.