use php dom parser inside another class - ERROR: Call to a member function on a non-object
<p>I'm using PHP simple dom parser <a href="http://simplehtmldom.sourceforge.net/manual.htm" rel="nofollow">http://simplehtmldom.sourceforge.net/manual.htm</a>. 
I'm able to successfully use it and remove an html tag with specific id by doing </p>

<pre><code>$html = str_get_html('&lt;div&gt;&lt;div class="two"&gt;two&lt;/div&gt;&lt;/div&gt;');     
function test($str, $class){
    $e = $str-&gt;find($class,0);
    $e-&gt;outertext = '';
    echo $str-&gt;outertext;
}
test($html, '#two'); 
</code></pre>

<p>My problem is when i try to use the function inside another php class. It doesn't work. Here's what i did</p>

<pre><code>$html = new simple_html_dom(); //initialized the object

class Someclass {
    public function test($wrap, $class){
        global $html;
        $html-&gt;load($wrap);
        $e = $html-&gt;find($class,0);
        $e-&gt;outertext = '';
        echo $html-&gt;outertext;
    }    
}
</code></pre>

<p>I'm getting an error <strong>Fatal error: Call to a member function load() on a non-object</strong>
What am i doing wrong. I'm i calling this correctly.</p>
