-
-
Notifications
You must be signed in to change notification settings - Fork 715
Closed
Labels
Milestone
Description
Smarty has no support for the null coalescing operator. One might argue that it is not required, since the default
modifier largely serves the same purpose. However, the default modifier is also triggered by an empty string: ''
, whereas the null coalescing operator would only replace a null value and leave everything else untouched.
Example:
{$myvar ?? 'undefined'}
This would render as 'undefined'
if and only if:
- myvar is undefined, or
- myvar is set to
null
- myvar is set to
'undefined'
Otherwise, it should return the value set for myvar.
ampmonteiro, JoelNiemela, MaccaA and moo2u2