Add a '<div></div>' container inside after every 3 loops
As an example
<div>
title
title
title
</div>
<div>
title
title
title
</div>
<div>
title
title
title
</div>
.
.
.
$dummyarray is in format of
$dummyarray = array(
[0] => 'title',
[1] => 'title',
[2] => 'title',
[3] => 'title',
.
.
)
foreach (array_chunk($dummyarray, 3, true) as $array)
{
echo '<div>';
foreach($array as $foo)
{
echo $foo->title;
}
echo '</div>';
}