Answers.Body: <p>The <code>???</code> operator has been dubbed the &quot;empty coalesce&quot; operator. It's similar to <a href="https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce" rel="nofollow noreferrer">the &quot;null coalesce&quot; operator</a> (<code>??</code>), but ignores empty strings (<code>&quot;&quot;</code>) and empty arrays (<code>[]</code>) as well.</p>
  <p>The empty coalescing operator isn't part of Craft (or Twig) core, which means your site likely has the <a href="https://plugins.craftcms.com/empty-coalesce" rel="nofollow noreferrer">Empty Coalesce</a> or <a href="https://plugins.craftcms.com/seomatic" rel="nofollow noreferrer">SEOmatic</a> plugins installed; both of these plugins add this operator to Twig.</p>
  <p>If you want to avoid using that non-standard operator, it can be replaced with the <a href="https://twig.symfony.com/doc/3.x/filters/default.html" rel="nofollow noreferrer"><code>|default</code></a> Twig filter:</p>
  <pre><code>{% set eventsButtonLabel = event.eventsButtonLabel|default('Book Ticket'|t) %}
  </code></pre>
  <p>(That last <code>??? null</code> in your example seems redundant, unless there is a static translation for 'Book Ticket' that is explicitly set to an empty string, and you specifically need the <code>eventsButtonLabel</code> variable to be <code>null</code> if that is the case).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-09T10:08:02.733Z
Answers.LastActivityDate: 2023-03-09T22:29:56.140Z
Answers.LastEditDate: 2023-03-09T22:29:56.140Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I know what the null coalescing operator (??) does. I have an example here with 3 operators and I am unsure what it does?</p>
  <p>Here is an example that I came across in a script I am trying to debug:</p>
  <pre><code>{% set eventsButtonLabel = event.eventsButtonLabel ??? 'Book Ticket'|t ??? null %}
  </code></pre>
  <p>What is the function of 3 operators?</p>
  
Tags: <craft3><templating><php>
Title: What does the triple operator ??? do in this case?
ThreadText: # What does the triple operator ??? do in this case?
  
  (Asked by: username_0 on 2023-03-09)
  
  I know what the null coalescing operator (??) does. I have an example here with 3 operators and I am unsure what it does?
  
  Here is an example that I came across in a script I am trying to debug:
  
  ```
  {% set eventsButtonLabel = event.eventsButtonLabel ??? 'Book Ticket'|t ??? null %}
  
  ```
  
  What is the function of 3 operators?
  
  **Tags:** craft3, templating, php
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-09. Score: 3
  
  The `???` operator has been dubbed the "empty coalesce" operator. It's similar to [the "null coalesce" operator](https://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.coalesce) (`??`), but ignores empty strings (`""`) and empty arrays (`[]`) as well.
  
  The empty coalescing operator isn't part of Craft (or Twig) core, which means your site likely has the [Empty Coalesce](https://plugins.craftcms.com/empty-coalesce) or [SEOmatic](https://plugins.craftcms.com/seomatic) plugins installed; both of these plugins add this operator to Twig.
  
  If you want to avoid using that non-standard operator, it can be replaced with the [`|default`](https://twig.symfony.com/doc/3.x/filters/default.html) Twig filter:
  
  ```
  {% set eventsButtonLabel = event.eventsButtonLabel|default('Book Ticket'|t) %}
  
  ```
  
  (That last `??? null` in your example seems redundant, unless there is a static translation for 'Book Ticket' that is explicitly set to an empty string, and you specifically need the `eventsButtonLabel` variable to be `null` if that is the case).
  
  
  ---
  
  