在指定次数的循环迭代后插入块

I am trying to fetch some info from database under ZF1 environment. I am using a for loop here. What I am trying to accomplish is that inserting a new css division (div) for each four iteration. In other words, I would like to insert a block followed by four loop iterations. For example, if I run a loop twelve times, there should be three new blocks after each four iterations. It is basically an advertisement block that may contain image and link. I need an idea.

Here is an example block.

<div class="flexblock-image">
    <a href="https://offers.example.com/offer/600112?cid=BWO_mh.com_html_getbackinshape&amp;keycode=254194">
        <img alt="" title="" typeof="foaf:Image" src="http://www.example.com.gif">
        </a>
    </div>

Here is the loop I have coded in my app.

<?php if ($this->numArticles > 0) : ?>
<?php for ($i = 0; $i < 13; $i++) : ?>
<div class="channel-image ">
    <div class="img">
        <h2 class="primary-tag">
            <a href="/tags/weight-loss-tips" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">
                <?php echo $this->articles[$i]->slug ; ?>
            </a>
        </h2>
        <a href="
            <?php echo $this->articles[$i]->getViewUrl(); ?>">
            <img typeof="foaf:Image" src="
                <?php echo $this->articles[$i]->getCover('crop'); ?>" width="650" height="412" alt="
                <?php echo addslashes($article->title); ?>" title="
                <?php echo addslashes($article->title); ?>">
            </a>
        </div>
        <div class="channel-content">
            <p class="date">
                <span property="dc:date dc:created" content="2015-06-04T11:06:18-04:00" datatype="xsd:dateTime">
                    <?php echo $this->dateFormatter()->diff(strtotime($this->articles[0]->activated_date), $this->timeDiffFormats); ?>
                </span>
            </p>
            <h2 class="article-title" id="title-node-93726">
                <a href="
                    <?php echo $this->articles[$i]->getViewUrl(); ?>">
                    <?php echo addslashes($this->articles[$i]->title); ?>
                </a>
            </h2>
            <div class="byline-container">
                <span class="byline-role">By  </span>
                <span class="field-author">
                    <a href="#" typeof="skos:Concept" property="rdfs:label skos:prefLabel" datatype="">
                        <?php echo sprintf($this->translator()->_('show.by'), $this->articles[0]->getAuthor()); ?>
                    </a>
                </span>
            </div>
        </div>
    </div>
    <?php endfor; ?>
    <?php endif; ?>

Not an expert on PHP, but wouldn't an if statement inside of your for loop work by using the modulus operator?

<?php for ($i = 0; $i < 13; $i++) : ?>

    <?php if ($i % 4 === 0) : ?>

        // Custom HTML/CSS here

    <?php endif; ?>

<?php endfor; ?>

More on the modulus operator can be found here