Created
June 18, 2019 12:15
-
-
Save williambeeler/fa9b9bb92446a8d185b8629cf8155ea6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$count = 1; | |
foreach( $items as $item ) | |
{ | |
if ($count%5 == 1) | |
{ | |
echo '<div class="5-results-wrapper">'; | |
} | |
echo '<p>Some item</p>'; | |
if ($count%5 == 0) | |
{ | |
echo "</div>"; | |
} | |
$count++; | |
} | |
//This is to ensure there is no open div if the number of elements is not a multiple of 5 | |
if ($count%5 != 1) echo "</div>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment