I have my markup structure as below:
value1 value2 value3
Why not use modulo to "close" a div?
$value) : ?> endforeach ?> endif ?>