title: How to add values into an associative array?
body: <p>If I want to add values to an array in a while loop I could do <code>$arr[] = "some"</code>. But how can I do this if I have an associative array, for example: </p>
  
  <pre><code>while($result = $result-&gt;fetch_array(MYSQLI_ASSOC))
  {
     $arr[]["some_key"] = "some";
     $arr[]["other_key"] = "some2";
  }
  </code></pre>
  
  <p>But this will give me something like <code>Array ( [0] =&gt; Array ( [some_key] =&gt; some) [1] =&gt; Array ( [other_key] =&gt; some2)</code>. So what is the right way to add values into an associative array inside a loop?</p>