Re: [PHP-LANG] PHP Class Question

[email protected] (Rasmus Lerdorf) Mon, 1 Oct 2001 08:45:32 -0700 (PDT)
Newsgroups php.lang
Message-ID <[email protected]>
> $class_object = new TempClass();
> $class_object->temp_var = 3;
> echo 'Temp Var = $class_object->temp_var';

echo 'Temp Var = '.$class_object->temp_var;

> class TempClass
> {
>     var $temp_var;
>
>     function TempFunc()
>     {
>         global $temp_var;
>         $temp_var = 3;
>         echo $temp_var;
>     }
> }

class TempClass {
    var $temp_var;

    function TempFunc()
    {
        $this->temp_var = 3;
        echo $this->temp_var;
    }
}

-Rasmus