null coalescing

$a ? $b : $c

Ternary operator

Does a truthy check on a value, returns the value to the left of : if true, returns the value to the right of : if false.

Tags
Related
true ? 'Yes' : 'No';  // "Yes"
false ? 'Yes' : 'No'; // "No"

What is this? Who are you!?

PHP Operators is a reference guide for operators old and new in the PHP programming language. We're SPATIE, a web development agency from Belgium. Besides client work we like to contribute to the open source community and make fun projects like this one.