I'm quite sure this question has been asked many times before, but here's the gist of it:
- Create a counter variable (commonly $i). Intilize it to a value of 1.
- After each iteration of the loop, check if $i modulo 3 has a value of 0. If so, echo a line break.
example:
$i = 1;
while(TRUE) {
// blah blah...
if($i % 3 == 0) echo '<br/>';
}