note 130635 added to language.operators.comparison
| From: | jlh@jlh.ch | Date: | Tue, 03 Feb 2026 12:21:09 +0000 |
| Subject: | note 130635 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222529@lists.php.net to get a copy of this message | ||
This might be obvious to some, but it's worth mentioning it explicitly: The null-coalescing
operator is a short-circuiting operator, meaning the right part will not be evaluated at all if it
is not used.
// expensiveInitialization() will never be called if $b is not null.
$a = $b ?? expensiveInitialization();
----
Server IP: 206.189.2.9
Probable Submitter: 85.195.255.242
----
Manual Page -- https://php.net/manual/en/language.operators.comparison.php
Edit -- https://main.php.net/note/edit/130635
Del: integrated -- https://main.php.net/note/delete/130635/integrated
Del: useless -- https://main.php.net/note/delete/130635/useless
Del: bad code -- https://main.php.net/note/delete/130635/bad+code
Del: spam -- https://main.php.net/note/delete/130635/spam
Del: non-english -- https://main.php.net/note/delete/130635/non-english
Del: in docs -- https://main.php.net/note/delete/130635/in+docs
Del: other reasons-- https://main.php.net/note/delete/130635
Reject -- https://main.php.net/note/reject/130635
Search -- https://main.php.net/manage/user-notes.php