title: Looping through a multidimensional associative array
body: <p>I've been making an IRC bot in PHP. I've given different users specific access levels between 0 and 5. 0 being a guest and 5 being an admin.</p>
  
  <p>I've been trying to write a command that when a user accesses it, it will send them a list of commands and syntax that they're allowed to use.</p>
  
  <p>So far I have something like this</p>
  
  <pre><code>$array = array
  (
      "5" =&gt; $commands = array
          (
              "test" =&gt; $test2 = array
                  (
                      "trigger" =&gt; "!test",
                      "descrip" =&gt; "Just testing."
                  )
              "test2" =&gt; $test3 = array
                  (
                      "trigger" =&gt; "!lol",
                      "descrip" =&gt; "another test."
                  ) 
          ) 
  );
  </code></pre>
  
  <p>I have no idea how to loop through it so that <code>if ($accessLevel == 5) then show commands for $array[5(and below)]</code></p>
  
  <p>At the end I want it to send out <code>$array[5][command][trigger] : $array[5][command][descrip]</code></p>
  
  <p>I don't necessarily need you to code it for me, just a push in the right direction would be helpful.</p>