Hi Guys,

I am wondering how to be able to call a class variable from within an outside function using the "::" syntax: See an example of the logic I am using below:


class myClass {
        
        var $variable = 1;
        
        function showVar() {
                return $this->variable;
        }
}


$obj = new myClass;

function extFunction() {
        return myClass::showVar();
}


I am assuming this isn't working because by calling myClass::showVar () instead of $obj->showVar() "$this" would be undefined...does anyone know how to workaround this (e.g. direct access to a variable via "::" syntax like myClass::variable). Does PHP5 address this at all?

Many thanks on this.

Best,
Mike D

...................................................................
Mike Dunlop
Director of Technology Development
[ e ] [EMAIL PROTECTED]
[ p ] 323.644.7808


Reply via email to