title: How to compare a string with a variable in TYPO3 Fluid
body: <p>I would like to do a simple comparisons, such as the equivalent of:</p>
  
  <p><code>if ($somevar === 'somestring')</code></p>
  
  <p>Now, I have found some examples where this is done like this:</p>
  
  <pre><code>&lt;f:if condition="{somevar} == 'somestring'"&gt; 
  ...
  </code></pre>
  
  <p>There are a number of places in the TYPO3 core 9.5 as well, <a href="https://github.com/TYPO3/TYPO3.CMS/blob/66a9f21977be4925b027c4f446cd37092178f4dc/typo3/sysext/install/Resources/Private/Partials/Settings/LocalConfiguration/SubSection.html#L18" rel="nofollow noreferrer">example</a>.</p>
  
  <p>But the official documentation tells us otherwise and that we must use a weird workaround based on arrays:</p>
  
  <blockquote>
    <p>Strings at XX/YY are NOT allowed, however, for the time being, a string comparison can be achieved with comparing arrays</p>
  </blockquote>
  
  <p><a href="https://docs.typo3.org/typo3cms/ViewHelperReference/latest/typo3fluid/fluid/latest/If.html" rel="nofollow noreferrer">If ViewHelper</a></p>
  
  <blockquote>
    <p>Comparisons with strings, like ...., are not possible with Fluid yet because of the complex implementation. </p>
  </blockquote>
  
  <p>(<a href="https://docs.typo3.org/typo3cms/ExtbaseFluidBook/8-Fluid/7-using-boolean-conditions.html#realize-complex-comparisons" rel="nofollow noreferrer">Extbase / Fluid</a>)</p>
  
  <p>Whatever that means ...</p>
  
  <p>In order to avoid asking why: What is the recommended way to do comparisons of strings and variables in TYPO3 9 and since when is this possible?</p>