Filling up the row before break column
I wonder how to fill up a row of images before breaking. With my code, I can set how many images I want to display in every row, but if I want to fill the rows up and then breaking automatically.
This is my code:
$files = glob("images/*.*", GLOB_BRACE);
foreach ($files as $key => $file) {
if ($key % 3 == 0) { // change 3 to how many items between rows
if ($key != 0) { echo ''.PHP_EOL;
}
echo '
'.PHP_EOL;
}
?>
Code: https://stackoverflow.com/users/661872/lawrence-cherone.
Don't really know how to credit
