title: First element of array by condition
body: <p>I am looking for an elegant way to get the first (and only the first) element of an array that satisfies a given condition.</p>
  
  <p><strong>Simple example:</strong></p>
  
  <p>Input:</p>
  
  <pre><code>[
      ['value' =&gt; 100, 'tag' =&gt; 'a'],
      ['value' =&gt; 200, 'tag' =&gt; 'b'],
      ['value' =&gt; 300, 'tag' =&gt; 'a'], 
   ]
  </code></pre>
  
  <p>Condition: <code>$element['value'] &gt; 199</code></p>
  
  <p>Expected output:</p>
  
  <pre><code>['value' =&gt; 200, 'tag' =&gt; 'b']
  </code></pre>
  
  <p>I came up with several solutions myself:</p>
  
  <ol>
  <li><p>Iterate over the array, check for the condition and break when found</p></li>
  <li><p>Use array_filter to apply condition and take first value of filtered:</p>
  
  <pre><code>array_values(
      array_filter(
          $input, 
          function($e){
              return $e['value'] &gt;= 200;
          }
      )
  )[0];
  </code></pre></li>
  </ol>
  
  <p>Both seems a little cumbersome. Does anyone have a cleaner solution? Am i missing a built-in php function? </p>