くわこのpermission denied.

WEBエンジニアの僕がぶつかった技術的な問題や発見

twigのforループにはbreakやcontinue文はないらしい。

twig内のforループでbreakしたい箇所があって、調べたら公式ドキュメントにがっつり「そんなもんないで( ´_ゝ`)」と書かれていた。

for - Documentation - Twig - The flexible, fast, and secure PHP template engine

Unlike in PHP, it's not possible to break or continue in a loop. You can however filter the sequence during iteration which allows you to skip items.


なるほど。というわけで普通にif分岐で処理をさける処理を書かないといけないらしい。