diff --git a/language/operators/comparison.xml b/language/operators/comparison.xml index 44c6a491ad4d..9295116067bc 100644 --- a/language/operators/comparison.xml +++ b/language/operators/comparison.xml @@ -462,7 +462,7 @@ echo 0 ?: 0 ?: 0 ?: 3, PHP_EOL; //3 // Example usage for: Null Coalesce Operator $action = $_POST['action'] ?? 'default'; -// The above is identical to this if/else statement +// The above is equivalent to this if/else statement if (isset($_POST['action'])) { $action = $_POST['action']; } else { @@ -473,14 +473,13 @@ if (isset($_POST['action'])) { The expression (expr1) ?? (expr2) evaluates to - expr2 if expr1 is - &null;, and expr1 otherwise. + expr1 if expr1 is set + and not &null;, otherwise expr2. - + In particular, this operator does not emit a notice or warning if the left-hand side - value does not exist, just like isset. This is especially - useful on array keys. - + value is not set. This is especially useful on array keys. + Please note that the null coalescing operator is an expression, and that it