Getting $this inside function
<p>I have a function outside of my class, and i'm calling it from inside using <code>call_user_func</code>, my problem is that i cant access class inside the function. i need a way to access my class without passing it in arguments, if there was a way to make <code>$this</code> work inside the function that would be wonderful.</p>

<p>Any advice other than passing class with argument into function will be appreciated;</p>

<pre><code>function test($arg1)
{
    $this-&gt;code = 10; // i know $this won't work here, 
                       // but i need a way to change $code 
                       // property from this function without 
                       // passing class into this function by using arguments
}

class MyClass
{
    public $code;
    public function call()
    {
         call_user_func("test", "argument1");
    }
}
</code></pre>
