title: simplify this array (php) json output
body: <p>I am having trouble on formatting my json. Basically I have this script structure,</p>
  
  <pre><code>$array1 = array();
  for($i = 0; $i &lt; 2 ; $i++)
  {
  $array1[] = array
  (
      "stocks" =&gt; array
      (
      "0" =&gt; "apple" 
      "1" =&gt; "banana"
      "2" =&gt; "mango"
  )
  );
  }
  </code></pre>
  
  <p>When executed, this outputs (in JSON format):</p>
  
  <pre><code>{
      stocks:
      {
          0 : apple,
          1 : banana,
          2 : mango
      }
  }
  
  {
      stocks:
      {
          0 : apple,
          1 : banana,
          2 : mango
      }
  }
  </code></pre>
  
  <p>My problem is, what changes do I have to make to produce an output like this:</p>
  
  <pre><code>{
      stocks:
      {
          0 : apple,
          1 : banana,
          2 : mango
      },
  
      stocks:
      {
          0 : apple,
          1 : banana,
          2 : mango
      }
  }
  </code></pre>