📢 Moderators Needed 🚀

Moderators are needed with resources to post or have access to resources to post. Submit an application to be considered.
X

RSS Support null coalescing operator (??) in templates

X

Xon

Guest
Guest or Bot
It would be really nice if the ?? operator (aka null coalescing operator) was supported in XF templates.

For example;
PHP:

$entity.property ?? 'default'
Which has the logic;
If $entity is null, or if property does not exist in $entity, or $entity->property is null, then the value of 'default' is returned.

This would essentially simplify this style of logic significantly;
PHP:

($entity && $reaction.isValidKey('property') && $reaction.property !== null) ...

Read more

Continue reading...
 
Similar content Most view View more
Back
Top