Php code that explodes tags from a form, puts commas after each one and breaks them in groups
<p>I have a form where I want to submit tags like this:</p>

<pre><code>tag1
tag2
tag3
tag4
...
tag n
</code></pre>

<p>*each tag on it's own line.</p>

<p>I get the tags in my php page:</p>

<pre><code>$tags = get_option('tags');
</code></pre>

<p>I now separate each tag by the new line criteria:</p>

<pre><code>$tag = explode("\n", $tags);
</code></pre>

<p>In a loop, I echo them:</p>

<pre><code>$i = '-1';
while(){ // usually a wordpress loop
    $i++;
    echo $tag[$i];
}
</code></pre>

<p>Finally I get:</p>

<pre><code>Tag1
Tag2
Tag3
...
Tag n
</code></pre>

<p>Here is where I need help.</p>

<ol>
<li><p><strong>I can't find a way to group tags - lets say by 3 and not explode them with every new line - "\n"
That would enable me to get something like this:</strong></p></li>
<li><p>*<strong>*Automatically put a comma after each tag in each line, except the last one.</strong></p></li>
</ol>

<p>It would be something like this:</p>

<pre><code>Tag1, Tag2
Tag3, Tag4
....
Tag n-1, Tag n
</code></pre>

<p>Any ideas?</p>

<p>Ty!</p>
