title: PHP multidimensional array key value
body: <p>I am working with multidimensional arrays;
  I use the arsort function to get the array that has been added the latest. This all works fine</p>
  
  <pre><code>arsort($this-&gt;shoppingBag);
  $this-&gt;productToShow = key($this-&gt;shoppingBag);
  </code></pre>
  
  <p>When i want to use this array i do:</p>
  
  <pre><code>$prodName = key($this-&gt;shoppingBag[$this-&gt;productToShow]);
  </code></pre>
  
  <p>this gives me the correct product with the correct name that I need. When i do</p>
  
  <pre><code>$count = $this-&gt;shoppingBag[$this-&gt;productToShow[$prodName]];
  </code></pre>
  
  <p>It gives me an "Undefined index" error. </p>
  
  <p>When I echo the array with the key as a string i get the correct value from that array..</p>
  
  <p>Why is this and how can I get the value with that key?</p>
  
  <p>edit:</p>
  
  <pre><code>array(4) 
  {
      [38] =&gt; array(1) 
      {
          ["SAMSUNG LE32D450"] =&gt; int(3)
      }
      [32] =&gt; array(1) 
      {
          ["Inspiron 15R"] =&gt; int(1)
      }
      [29] =&gt; array(1) 
      {
          ["XPS 15"] =&gt; int(25)
      }
      [37] =&gt; array(1) 
      {
          ["Logitech M185 Black"] =&gt; int(10)
      }
  }
  </code></pre>