Modify a laravel blade variable without displaying it
<p>In my blade code, I need a counter, to give divs that are rendered by a foreach loop unique id's. For that purpose I created a variable in my blade template like this:</p>

<pre><code>{{ $counter = 0 }}
</code></pre>

<p>I use it in the html by just outputting it with <code>{{ $counter = 0 }}</code></p>

<p>and the later on, I increment it like this:  <code>{{ $counter++ }}</code></p>

<p>It all works like a charm, except that at <code>{{ $counter++ }}</code> it's not only incrementing the variable, it's also outputting it to the view.</p>

<p>is there any way to prevent this?</p>