title: Get the maximum value from an element in a multidimensional array?
body: <p>I'm trying to select the maximum value for a particular key in a multidimensional array.  I'm having trouble "getting to" the key in question... </p>
  
  <p>So, the array (which is much more lengthy than what I'm posting here)</p>
  
  <pre><code>[0] =&gt; stdClass Object
      (
          [id] =&gt; 70
          [cust] =&gt; 4
          [dnum] =&gt; 1
          [upper] =&gt; Array
              (
                  [0] =&gt; 66
              )
  
      )
  [1] =&gt; stdClass Object
      (
          [id] =&gt; 43
          [cust] =&gt; 42
          [dnum] =&gt; 2
          [upper] =&gt; Array
              (
                  [0] =&gt; 77
              )
  
      )
  [2] =&gt; stdClass Object
      (
          [id] =&gt; 12
          [cust] =&gt; 3
          [dnum] =&gt; 0
          [upper] =&gt; Array
              (
                  [0] =&gt; 99
              )
  
      )
  </code></pre>
  
  <p>I'm trying to find the maximum "dnum" value across the entire array, so in this example, $max = 2.  I know that the max function allows me to do this, but I'm not sure how to reference the dnum element without putting the whole thing in a foreach loop, and if I do that, then max wouldn't be the function to use, right? </p>
  
  <p>So, I can't exactly do this: </p>
  
  <pre><code>$max = max($myarray[]-&gt;dnum);
  </code></pre>
  
  <p>Is there a way for me to do this without having to recreate the entire array?</p>