php - How to "break" a loop in Twig? -


i want use break in twig template engine.

{% key, db_staff_language in db_staff_languages %}   {% staff_language in model_data.staff_languages %}     {% if staff_language.id == db_staff_language.id %}         <option value="{{db_staff_language.id}}" selected="selected">{{db_staff_language.staff_languages_data_translation[0].value}}</option>     {% else %}         <option value="{{db_staff_language.id}}">{{db_staff_language.staff_languages_data_translation[0].value}}</option>     {% endif %}     {% break %}   {# <-- not working #}   {% endfor %} {% endfor %} 

as couldn't solve problem twig, tried other things, like:

----------------------------------------------- {% autoescape true %} <?php echo 'test' ?> {% endautoescape %} ----------------------------------------------- {% php %} <?php echo 'test' ?> {% endphp %} ----------------------------------------------- {% verbatim %} <?php echo "test"; ?> {% endverbatim %} ----------------------------------------------- {{ raw }} <?php echo "test"; ?> {{ endraw }} ----------------------------------------------- 

is there solution problem?

twig doesn't include break statement. according official manual, equivalent instruction for + if condition.


Comments