title: Filter usernames in an array based on the highest score
body: <p>We have a online mini game on our platform where users with similar names, such as: <code>Username</code>, <code>UserName</code> and <code>username</code> face each other. All this works perfectly, but now we are adding a leaderboard that takes your data out of a PHP array.</p>
  
  <pre><code>$positions = ConfrontationGame::getResults()-&gt;toArray();
  </code></pre>
  
  <p>Then the <code>$positions</code> variable is an array that has the following structure:</p>
  
  <pre><code>$positions =&gt; array {
  
      [
          'username' =&gt; 'Exampleusername',
          'score' =&gt; '74'
      ],
      [
          'username' =&gt; 'ExampleUsername',
          'score' =&gt; '14'
      ],
      [
          'username' =&gt; 'exampleusername',  // WINNER
          'score' =&gt; '96'
      ]
  
  }
  </code></pre>
  
  <p>We use this array to create a table of positions where users with similar usernames (<code>EmapleUsername</code>,<code>Exampleusername</code> and <code>exampleusername</code>) who faced each other should only leave the one with the highest score, in this case the winner <code>exampleusername</code></p>
  
  <p>This is what we have:</p>
  
  <pre><code>$results_table = array_filter($positions, function($val, $key) {
  
          if($key === 'username' &amp;&amp; in_array(strtolower($val), $positions)) {
              if($key === 'score') {
                  // ...
                  // What is done here?
              }        
          }
  
      }, ARRAY_FILTER_USE_BOTH);
  </code></pre>