PHP quququi Test Question 1

Source: Internet
Author: User
$ A3; $ b5; if ($ a5 | $ b7) {$ a ++; $ B ++;} echo $ a, $ B; the output result is: a, 68B, 66C, 26D, 16E, 46 think about it ..... the answer is 16 because ($ a5 | $ b7) can actually be written as ($ a (5 | ($ b7). Here we take the calculation priority. Second truetrue, this

$ A = 3; $ B = 5; if ($ a = 5 | $ B = 7) {$ a ++; $ B ++;} echo $ ,, $ B; output result: A, 6 8 B, 6 6 C, 2 6 D, 1 6 E, 4 6 think about it ..... the answer is 1 6 because ($ a = 5 | $ B = 7) can actually be written as ($ a = (5 | ($ B = 7 ))), the calculation priority is used here. The second value is true = true.

$a = 3;$b = 5;if($a = 5 || $b = 7){$a++;$b++;}echo $a, ' ', $b;

Output result:

A, 6 8

B, 6 6

C, 2 6

D, 1 6

E, 4 6


Think about it .....




































































The answer is 1 6.

Because ($ a = 5 | $ B = 7) can actually be written as ($ a = (5 | ($ B = 7), the calculation priority is used here.

The second value is true ++ = true. Here the incremental operation is used. The increment and decrement operations do not affect the Boolean value, but do not affect NULL. If you perform the increment operation on NULL, you will get 1. ProcessingCharacterDuring Variable arithmetic operations, PHP follows the Perl habit, rather than C. Character variables can only increase and cannot decrease.

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.