title: Laravel's collection filter pass by reference not working
body: <p>can you please help me in using closures. I'm using laravel's collection filter to check unique emails. The code below should fill the <code>$unique_email</code> array inside the filter function. Is there's a problem on how i used the pass by reference? Thanks in advance.</p>
  
  <pre><code>    $unique_email = array();
  
      $users-&gt;filter(function ($user) use (&amp;$unique_email) {
          if( !in_array(   $user-&gt;email , $unique_email  ) ) {
              return $unique_email[] = $user-&gt;email;              
          }
      });
  
      dd($unique_email); //returns empty array
  </code></pre>