Adding a item to an associative array
<p><strong>Solution</strong></p>

<p><code>$data[$category] = $question;</code> replaced <code>$data = array($category =&gt; $question);</code></p>

<hr>

<pre><code>//go through each question
foreach($file_data as $value) {
   //separate the string by pipes and place in variables
   list($category, $question) = explode('|', $value);

   //place in assoc array
   $data = array($category =&gt; $question);
   print_r($data);

}
</code></pre>

<p>This is not working as it replaces the value of data. How can I have it add an associative value each loop though? <code>$file_data</code> is an array of data that has a dynamic size.</p>
