title: Instanceof operator in Twig/Symfony 2?
body: <p>I've a mixed array like this one (mobile numbers and entities):</p>
  
  <pre><code>$targets = array();
  
  $targets[] = '+32647651212';
  $targets[] = new Customer();
  </code></pre>
  
  <p>In my Twig template i have to call <code>getMobile()</code> if <code>target</code> is a <code>Customer</code> or just print the number if it's actually a number (<code>string</code>).</p>
  
  <p>Is there something like <code>instanceof</code> operator in Twig?</p>
  
  <pre><code>&lt;ul&gt;
  {% for target in targets %}
     &lt;li&gt;{{ target instance of MyEntity ? target.getMobile : target }}&lt;/li&gt;
     {% else %}
         &lt;li&gt;Nothing found.&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>