Trabla: Twig & php: find substring in the string
Solving:
Simply use in operator:
{{ 1 in [1,2,3] }}
{{ 'aa' in 'aabcd' }}
Example:
{% if 'failed' in message %}
<font color="red"> {{message}} </font>
{% else %}
<font color="green"> {{message}} </font>
{% endif %}
No comments:
Post a Comment