Variable type is null in remote class
<p>Here is my main class</p>

<pre><code>class pMr {
    const VERSION = '0.0.3';
    public $_connection;
    private $_sessionName = 'LoginSession';

    public function __construct($function = null) {
        ...
            $this-&gt;buildConnection('Predis');
        ...
    }

    private function buildConnection($type = 'Predis') {
        ...
            if($type == 'Redis') {
                ...
            } else if($type == 'Predis') {
                try {
                    $this-&gt;_connection = new Predis\Client(array(
                        'host'     =&gt; $_SESSION[$this-&gt;_sessionName]['hostname'],
                        'password' =&gt; $_SESSION[$this-&gt;_sessionName]['password'], 
                        'database' =&gt; $_SESSION[$this-&gt;_sessionName]['database'], 
                    ));
                } catch (ClientException $e) {
                    die($e-&gt;getMessage());
                }
                var_dump(gettype($this-&gt;_connection));  
            }
        }
    }
}
</code></pre>

<p>Now, when that code runs, I get <code>string(6) "object"</code>, which is expected. Now, here is another class, which is loaded inside the main class and then executed (a function is called).</p>

<pre><code>class Interface {
    static $_execOnLoad = true;
    public static function getRedisVersion() {
        global $pMr;
        var_dump(gettype($pMr-&gt;_connection));
    }
}
</code></pre>

<p>Now, in that function (when its called), returns NULL. This is the same variable that returns as an object in the above code. Why is this, and what is the work around?</p>
