--- 3 php interview topics, operator inspection point

--- 3 php interview topics, operator inspection point

A summary

Sentence summary:

Note that different logical operators shorting effect, priority issues directly brackets, && and || also noted with priority or and and

 

1, the difference between foo () and @foo ()?

@foo () error suppression

 

2, PHP operator error control character @?

PHP supports one error operator: @. When it is placed before a PHP expression, the expression of any possible error messages are ignored

 

3, php operator precedence?

Up / Down>! > Arithmetic Operators> Comparison of size> (no) is equal to Comparative> Reference> bitwise operator (^)> bitwise operator (|)> logic> logic or> trinocular> Assignment> and> xor> or
Brackets: Use parentheses to increase readability of the code can be recommended

 

4, php comparison operators test sites?

The difference between == and ===
Analyzing equivalent (FALSE case seven)

 

5, php increment / decrement operators pay attention to point?

A Boolean value: increment / decrement operators do not affect boolean values: true ++ or true; true-- still true
NULL: NULL value is not decreasing effect, incrementing a value of NULL
Increment decrement symbol locations: front to increment and decrement the first operator returns, otherwise return to the first, after the operation

 

6, php logical operator attention point?

A short circuit
&& and || or different and and and priority
Key memory increment / decrement operators rules of operation, the effect of short-circuiting logical operators, the logical operators to see more consideration to priority issues

 

7, interpreting the results of the following two expressions?

|||-begin

$a=false || true;→true
$b=false or true;→false

|||-end

= || higher priority (number assignment)
priority less than or = (assignment number); the lowest priority logical operators in the English state

 

8, this expression ($ a = 3> 0 || $ b = 3> 0) of the order of execution is what?

1、(3>0)
2、(3>0||$b=3>0)
3, ($ a = (3> 0 || $ b = 3> 0)); $ b = 3> 0 is not implemented due to the short-circuit logic

 

 

 

 

Second, content in summary

 

 

 

 

Reproduced in: https: //www.cnblogs.com/Renyi-Fan/p/11058755.html

Guess you like

Origin blog.csdn.net/weixin_34166472/article/details/93572344