How to correctly build an array
<p>I'm having an issue getting this array into a format that I can use. There is additional data that is not showing up in my foreach loop. Can someone please look at the way I've built the array and tell me what I'm doing wrong?</p>

<p>There will be more than one dept and more than one location. The location is dependent on how many locations the department has.</p>

<pre><code>   foreach...
    $arr[$db['name']] =
      array($db['date'] =&gt;
        array($db['dept'] =&gt; (Need other departments to show)
          array($db['location'] =&gt; $db) (Need more locations for above dept.)
        )
      );
</code></pre>

<hr>

<p>Gives me:</p>

<pre><code>Array
(
  [training] =&gt; Array
  (
    [08-24-2011] =&gt; Array
    (
      [dept1] =&gt; Array &lt;----------There is more than one department that should show
      (
        [dept1 Other] =&gt; Array &lt;--There is more than one location that should show
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
      )
    )
  )
)
</code></pre>

<hr>

<p>This is what I'm after. I just need to know how to order it so that my array produces this putput;</p>

<pre><code>Array
(
  [training] =&gt; Array
  (
    [08-24-2011] =&gt; Array
    (
      [dept1] =&gt; Array
      (
        [dept1 Other] =&gt; Array
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
        [dept2 Other] =&gt; Array
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
      )
      [dept2] =&gt; Array
      (
        [dept1 Other] =&gt; Array
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
        [dept2 Other] =&gt; Array
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
        [dept3 Other] =&gt; Array
        (
          [start_time] =&gt; 03:00
          [end_time] =&gt; 19:00
        )
      )
    )
  )
)
</code></pre>
