title: How can I traverse a 2D array in having sparse keys to access inner arrays?
body: <p>I've got this 2D array $userDesignatedCategory. </p>
  
  <pre><code>Array ( 
      [1] =&gt; Array (
          [0] =&gt; CEO 
          [1] =&gt; Assistant Art Director 
          [2] =&gt; Assistant Choreographer 
          [3] =&gt; Assistant Creative Director 
          [4] =&gt; Assistant Director 
          [5] =&gt; Assistant Editor 
          [6] =&gt; Assistant Equipment Engineer 
          [7] =&gt; Assistant Hair Dresser 
          [8] =&gt; Assistant Lighting Director 
          [9] =&gt; Assistant Make Up Artist 
      ) 
      [2] =&gt; Array ( 
          [0] =&gt; Senior Developer 
      ) 
      [3] =&gt; Array ( 
          [0] =&gt; CEO 
          [1] =&gt; Script Supervisor 
          [2] =&gt; Creative Director 
          [3] =&gt; Anchor 
          [4] =&gt; Executive Producer 
          [5] =&gt; Director 
          [6] =&gt; Actor 
      ) 
      [7] =&gt; Array ( 
          [0] =&gt; Director 
          [1] =&gt; Executive Producer 
          [2] =&gt; Journalist 
          [3] =&gt; Producer 
      ) 
      [10] =&gt; Array ( 
          [0] =&gt; Head of Division 
          [1] =&gt; Vice President 
      ) 
      [11] =&gt; Array ( 
          [0] =&gt; Anchor 
          [1] =&gt; Chairman 
          [2] =&gt; Co Founder 
          [3] =&gt; Creative Director 
          [4] =&gt; Director 
      ) 
      [13] =&gt; Array ( 
          [0] =&gt; Associate Producer 
      ) 
      [16] =&gt; Array ( 
          [0] =&gt; Accounts Manager 
      ) 
      [20] =&gt; Array ( 
          [0] =&gt; Adventure Cameraperson 
          [1] =&gt; Cameraperson 
          [2] =&gt; Director Of Photography 
          [3] =&gt; Underwater Cameraperson 
      ) 
      [21] =&gt; Array ( 
          [0] =&gt; Director 
          [1] =&gt; Screenplay Writer 
          [2] =&gt; Writer 
      ) 
      [28] =&gt; Array ( 
          [0] =&gt; Director 
      ) 
      [50] =&gt; Array ( 
          [0] =&gt; Cameraperson 
      ) 
      [73] =&gt; Array ( 
          [0] =&gt; Accounts Manager 
          [1] =&gt; Actor 
          [2] =&gt; Aerial Cameraperson 
          [3] =&gt; Anchor 
      ) 
      [78] =&gt; Array ( 
          [0] =&gt; Accounts Manager 
          [1] =&gt; Aerial Cameraperson 
          [2] =&gt; Animator 
      ) 
      [79] =&gt; Array ( 
          [0] =&gt; Actor 
          [1] =&gt; Anchor 
          [2] =&gt; Adventure Cameraperson 
          [3] =&gt; Aerial Cameraperson 
          [4] =&gt; Animation Director 
          [5] =&gt; Animator 
          [6] =&gt; Assistant Make Up Artist 
          [7] =&gt; Assistant Manager 
      ) 
      [82] =&gt; Array ( 
          [0] =&gt; Adventure Cameraperson 
          [1] =&gt; Cameraperson 
          [2] =&gt; Director Of Photography 
          [3] =&gt; Associate Producer 
      )
      [86] =&gt; Array ( 
          [0] =&gt; Director 
          [1] =&gt; Producer 
          [2] =&gt; Writer 
      ) 
      [87] =&gt; Array ( 
          [0] =&gt; Co Founder 
          [1] =&gt; Vice President 
      ) 
  ) 
  </code></pre>
  
  <p>I have sparse keys so I cant use <code>for($i=0;i 'less than' count;$i++)</code></p>
  
  <p>I've used <code>foreach($userDesignatedCatogery as $key =&gt; $value)</code> but it didnt help either.</p>
  
  <p>How can I traverse this array to access inner arrays?</p>