title: Getting an array key using the max() function
body: <p>I'm using the max() function to find the largest value in an array.  I need a way to return the key of that value.  I've tried playing with the array_keys() function, but all I can get that to do is return the largest key of the array.  There has to be a way to do this but the php manuals don't mention anything.</p>
  
  <p>Here's a sample of the code I'm using:</p>
  
  <pre><code>$arrCompare = array('CompareOne' =&gt; $intOne,
                      'CompareTwo' =&gt; $intTwo,
                      'CompareThree' =&gt; $intThree,
                      'CompareFour' =&gt; $intfour);
  
  $returnThis = max($arrCompare);
  </code></pre>
  
  <p>I can successfully get the highest value of the array, I just can't get the associated key.  Any ideas?</p>
  
  <hr>
  
  <p>Edit:  Just to clarify, using this will not work:</p>
  
  <pre><code>$max_key = max( array_keys( $array ) );
  </code></pre>
  
  <p>This compares the keys and does nothing with the values in the array.  </p>