PHP : Passing DB Link Identifier into array_map's inner function
<p>Based on my previous <a href="http://stackoverflow.com/a/16034581/188331">question</a>'s answer , I have to use an inner function for <code>array_map()</code> as follow:</p>

<pre><code>    $keyword_tokens = array_map(
        function($keyword) {
            return $this-&gt;db-&gt;escape_string(trim($keyword));
        }, $keyword_tokens
    );
</code></pre>

<p><code>$this-&gt;db</code> is a MySQLi database wrapper, while its function <code>escape_string()</code> is a wrapper of <code>mysqli_real_escape_string()</code>.</p>

<p>The problem is, PHP prompts error:</p>

<blockquote>
  <p><strong>Fatal error:</strong> Using $this when not in object context</p>
</blockquote>

<p>However, the <code>array_map</code> code piece is within a public function within a class. My question is: How can I reference <code>$this-&gt;db</code> in the <code>array_map()</code>'s inner function ?</p>
