Jump to content

[SOLVED] How to add a <br> after 3 results?


t_machine

Recommended Posts

hi, I am wondering if anyone could help me solve this issue.

I am using a foreach loop and i would like to add a line break after three records then repeat the process.

 

Example:

 

foreach($array as $v){

echo $v.' ';

}

 

In that example, it will display ( apples oranges banana pumpkin turnips pineapple beer pepsi)

 

How do i get it to display:

 

apples oranges banana

pumpkin turnips pineapple

beer pepsi etc....

 

Notice above that after each three results the next three are placed on a new line. How can I accomplish that with my loop.

 

Thanks very much for any help :)

 

 

Link to comment
https://forums.phpfreaks.com/topic/67589-solved-how-to-add-a-after-3-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.