note 115547 rejected from function.isset by salathe
| From: | salathe@php.net | Date: | Fri, 22 Aug 2014 08:09:28 +0000 |
| Subject: | note 115547 rejected from function.isset by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200259@lists.php.net to get a copy of this message | ||
Note Submitter: dcrooke at gmail dot com
----
It would be nice to have a built-in function that implements the following idiom, similar to the SQL
function COALESCE() or NVL()
$data = isset($complex->expression) ? $complex->expression : $default;
You can write your own, as follows ...
function nvl(&$var, $default) {
return isset($var) ? $var : $default;
}
which works in many cases.