I'm trying to wrap two columns inside of a row div from inside a php loop.
I came up with this test but it fails no matter what I do.. This is the closest I can come, I can't see where this logic fails.
Take a look:
<?php $i = 0; ?>
<?php while($i < 11) : ?>
<?php if ($i % 2 === 0) : ?>
<div class="row">row
<?php endif; ?>
<span><?php echo "[" . $i . "]"; ?></span>
<?php if (!$i % 2 === 0) : ?>
/row
</div>
<?php endif; ?>
<?php $i++; ?>
<?php endwhile; ?>
The produced result:
row [0] [1] /row
row [2] /row
[3] /row
row [4] /row
[5] /row
row [6] /row
[7] /row
row [8] /row
[9] /row
row [10] /row
Here we can see that the first row is working great but then it becomes flawed somewhere in the logic, question is where?