Importing PHP variables from one scope level up
<p>I want to <code>array_filter</code> an array inside a function:</p>

<pre><code>function filter($array, $check){
    return array_filter($array,function($val){return $val==$check;});
}
</code></pre>

<p>Note: This is a simplified scenario.</p>

<p>This doesn't work, because <code>$check</code> is not defined in the filter function, but I can't use <code>global $check;</code> neither because it can't import variables from ONE level up. I also can't pass it as argument.</p>

<p>Any workarounds?</p>
