title: Faster way to see if an array contains values besides the one specified
body: <p>I have an array where each element has a subarray with multiple Ids.  When looping through the array, I'd like to check if the subarray has any elements besides a given one.</p>
  
  <p>For example, I'd like to echo 'Yes' whenever one of the subarrays has any ids other than 'TESTID'.</p>
  
  <p>I can do this by looping through the subarray, but I'd like to know of a way that doesn't require double loops.</p>
  
  <p>Here's the current code:</p>
  
  <pre><code>foreach ($elements as $element) {
      ...
  
      if (besidesInArray('TESTID',$element['ids'])) {
          //operations
      } else {
          //element only has 'TESTID'
      }
  
  ...
  }
  ...
  
  function besidesInArray($needle, $haystack) {
      foreach ($haystack as $hay) {
          if($hay != $needle) {
              return TRUE;
          }
      }
  
      return FALSE;
  }
  </code></pre>
  
  <p>While this code works, I'd like to see if there's a more elegant solution.</p>