Today I learned: about max() array magic

Ethan's picture

Today I learned:

  1. That there's always more tricks in the PHP bag
  2. That the max() command will return the element with the highest-value key when returned an associative array. So, given $a = array(1 => "red", 5 => "green", 10 => "blue");, max($a) will return "blue".