Call php class method from string with parameter
<p>I am having trouble calling a <strong>class method</strong> from a string in PHP. Here's a simple example. Once I get this working I'll be using a variable as the method name.</p>

<p>Here's how I'd be calling the method normally:</p>

<pre><code>$tags_array = $this-&gt;get_tags_for_image($row["id"]);
</code></pre>

<p>Here's how I'm trying but getting an error:</p>

<pre><code>$tags_array = call_user_func('get_images_for_tag', $row["id"]);
</code></pre>

<p>I must be missing the scope but I can't figure out how to call the method.</p>

<p>----EDIT
Figured out that this calls the method but <strong>$row</strong> is undefined now I believe</p>

<pre><code>$tags_array = call_user_func(array($this, 'get_images_for_tag'), $row["id"]);
</code></pre>

<p>Full code block:</p>

<pre><code> $images = call_user_func(array($this, 'get_images_for_tag'), $filter);
        foreach ($images as $row){

            $tags_array = call_user_func(array($this, 'get_images_for_tag'), $row["id"]);
            foreach ($tags_array as $tag_row){
                $tags_array[] =  $tag_row["tag"];
            }

            $image_array []= array (
                'url' =&gt; $this-&gt;gallery_path_url . '/'. $row["name"],
                'thumb_url' =&gt; $this-&gt;gallery_path_url . '/thumbs/' . 't_'. $row["name"],
                'id' =&gt; $row["id"],
                'description' =&gt; $row["description"],
                //'url' =&gt; $row["url"],
                'tags' =&gt; $tags_array
                );
        }
</code></pre>
