1.2.157. Coalesce

Usage of coalesce operator.

Note that the coalesce operator is a special case of the ternary operator.

<?php

// Coalesce operator, since PHP 5.3
$a = $b ?: 'default value';

// Equivalent to $a = $b ? $b : 'default value';

?>

See also Ternary Operator.

1.2.157.1. Connex PHP features

1.2.157.1.1. Specs

Short name

Php/Coalesce

Rulesets

All, Appinfo, CE, Changed Behavior, One Liners

Exakat since

0.8.4

PHP Version

With PHP 5.3 and more recent

Severity

Time To Fix

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud