title: In twig template run php code
body: <p>Is it possible to make twig function rendered as php-code, as I need to exit current template, something like this:</p>
  
  <pre><code>{% if HostelsList|length == 0  %}
      {# &lt;div&gt;No Data Found.&amp;nbsp;&lt;/div&gt; #}
      {{ make_return() }} {# |raw #}
  {% endif %}
  </code></pre>
  
  <p>and function definition:</p>
  
  <pre><code>$function = new Twig_SimpleFunction('make_return', function () {
      echo '&lt;pre&gt;make return&lt;/pre&gt;'; // I see this output
      return '&lt;?php echo "ZZZZZ"; return; ?&gt;';  // I DO NOT see this output and flow is not stopped rendering...
  } , array('is_safe' =&gt; array('all' ) );
  $this-&gt;m_twig_Environment-&gt;addFunction($function);
  </code></pre>
  
  <p>Also i tried to use <code>|raw</code> in 1st statement, but failed. Which is the right way?</p>
  
  <p>Thanks!</p>