title: How can I foreach loop through and print out specific values from multidimensional array
body: <p>This maybe duplicate, but I couldn't find the anwser looking aroud topics.</p>
  
  <p>I have an array, witch looks like this:</p>
  
  <pre><code>$itemx=
   [
       'Weapons'=&gt;[
            'Sword'=&gt; [
               'Name'   =&gt; 'Lurker',
               'Value'  =&gt; '12',
               'Made'   =&gt; 'Acient'
             ],
  
             'Shield'=&gt; [
                'Name'   =&gt; 'Obi',
                'Value'  =&gt; '22',
                'Made'   =&gt; 'Acient'
              ],
  
              'Warhammer'=&gt; [
                 'Name'   =&gt; 'Clotch',
                 'Value'  =&gt; '124',
                 'Made'   =&gt; 'Acient'
               ]
       ],
       'Drinks'=&gt;[
         'Water'=&gt; [
            'Name'   =&gt; 'Clean-water',
            'Value'  =&gt; '1',
            'Made'   =&gt; 'Acient'
          ],
  
          'Wine'=&gt; [
             'Name'   =&gt; 'Soff',
             'Value'  =&gt; '5',
             'Made'   =&gt; 'Acient'
           ],
  
           'Vodka'=&gt; [
              'Name'   =&gt; 'Laudur',
              'Value'  =&gt; '7',
              'Made'   =&gt; 'Acient'
            ]
       ]
  
  
   ]; 
  </code></pre>
  
  <p><strong>I want to echo out the item Categories(Weapons,Drinks),Types(Sword,Water,etc) what they hold.</strong></p>
  
  <p>I tried just an regular foreach and so they echo arrays.</p>
  
  <pre><code>  function getAllCategories()
    {
      foreach ($this-&gt;_prop as $cate)
      {
        echo $cate;
        foreach ($cate as $type)
        {
          echo $type;
        }
  
      }
    }
  </code></pre>
  
  <p>So i thought I can select from the arrays.</p>
  
  <pre><code>  function getAllCategories()
    {
      foreach ($this-&gt;_prop as $cate)
      {
        echo $cate[0];
        foreach ($cate as $type)
        {
          echo $type[0];
        }
  
      }
    }
  </code></pre>
  
  <p>But they echo'd nothing and I dont understand how could I print those values out that I want.</p>