function nonempty(...)Arcanist Technical Documentation ()
function nonempty(...)
Arcanist Technical Documentation ()
Similar to coalesce(), but less strict: returns the first non-empty() argument, instead of the first argument that is strictly non-null. If no argument is nonempty, it returns the last argument. This is useful idiomatically for setting defaults:
$display_name = nonempty($user_name, $full_name, "Anonymous");
Parameters
... | Zero or more arguments of any type. |
Return
mixed | First non-`empty()` arg, or last arg if no such arg exists, or null if you passed in zero args. |
- Defined
- src/utils/utils.php:753