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.
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:
This would render as
'undefined'
if and only if:null
'undefined'
Otherwise, it should return the value set for myvar.