I need some help adding a closing <div> tag to my php. I want the closing tag to placed when a row of items is either 4 items long or less. So say I have two rows, one with 4 entries and one with 3... The row with 4 should add the closing div after the 4th entry, and the one with 3 should add the closing div after the 3rd (or draw a blank 4th div; which may be a better option).
Here's what I have so far:
PHP Code:
$i=0;
foreach(glob('./images/stills/story_boards/*.*') as $filename){
if($i==0){
$content2.='<div>';
}
//$content2.='<img src="'.$filename.'" />';
$i++;
if($i==5){
$i=0;
}
}
$content2.='</div>';