PHP two comparison operators [??] [:?] Difference

1. [??] NULL union operator
$ a ?? $ b
i.e.
? Isset ($ a) $ a : $ b;

Note: isset () has been set and is not NULL

 

2. [?:] shorthand ternary operator
$ a: $ B?
Ie
$ a $ a: $ B;?

Note: When $ a is not asserted, [??] not being given (as with the isset), [?:] will be reported in a Notice

 



 

Guess you like

Origin www.cnblogs.com/lzs-888/p/11207457.html