Blogger Information
Blog 9
fans 0
comment 0
visits 11854
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP 三元运算 ??与?:
何书鹏的博客
Original
1245 people have browsed it

//$c = $a ?? $b;  等效  $c = isset($a) ? $a : $b;

//$c = $a ?: $b; 等效  $c = $a ? $a : $b;

$a = 'a';

$b = 'b';

$c = $a ?? $b; //a

$c = $a ?: $b; //a

$a = false;

$b = 'b';

$c = $a ?? $b; //false

$c = $a ?: $b; //b


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments