php question regarding arrays
<p>I'm a (complete) php noob and need a little help with something.</p>

<p>I'm working on a project whereby a user can select up to 6 categories via a form (I'm using ExpressionEngine). The output is like this:</p>

<pre><code>"Cat1","Cat2","Cat3"
</code></pre>

<p>...and so on. The user can select up to 6 categories on that form.</p>

<p>What I need: even if my result is 3 categories I need to have 6 'cells' - for want of a better word - even if they're empty:</p>

<pre><code>"Cat1","Cat2","Cat3","","",""
</code></pre>

<p>I've tried this:</p>

<pre><code>&lt;?php
$str = '(output goes here)';
print_r(explode(',', $str, 6));
?&gt;
</code></pre>

<p>...but the output give me: </p>

<pre><code>Array
(
[0] =&gt; Cat1
[1] =&gt; Cat2
[2] =&gt; Cat3
[3] =&gt;
[4] =&gt;
[5] =&gt;
</code></pre>

<p>)</p>

<p>How do I get from that to this:</p>

<pre><code>"Cat1","Cat2","Cat3","","",""
</code></pre>

<p>Does this make sense?</p>

<p>Thanks
Martin</p>
