title: Use external variable in array_filter
body: <p>I've got an array, which I want to filter by an external variable.
  The situation is as follows:</p>
  
  <pre><code>$id = '1';
  var_dump($id);
  $foo = array_filter($bar, function($obj){
      if (isset($obj-&gt;foo)) {
          var_dump($id);
          if ($obj-&gt;foo == $id) return true;
      }
      return false;
  });
  </code></pre>
  
  <p>The first <code>var_dump</code> returns the ID (which is dynamically set ofcourse), however, the second <code>var_dump</code> returns NULL.</p>
  
  <p>Can anyone tell me why, and how to solve it?</p>