Re: [Class] Behaviour global variables
| From: | lallous | Date: | Wed, 14 Aug 2002 14:36:10 +0000 |
| Subject: | Re: [Class] Behaviour global variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112535@lists.php.net to get a copy of this message | ||
hmmm....what are you missing?
globals $a and $b are not defined!
try to set error reporting to E_ALL and try running your code again.
Elias
"Tim Stoop" <tim@cidev.nl> wrote in message
news:20020814132724.92896.qmail@pb1.pair.com...
> Hi there,
>
> I'm forgetting something, but I can't seem to get to it... Consider the
> following Class.
>
> class Test
> {
> var $a;
> var $b;
>
> function Test()
> {
> $this->a = 2;
> $this->b = 5;
> }
>
> function Show()
> {
> global $a, $b;
>
> echo("a: ".$a);
> echo("a: ".$this->a);
> echo("b: ".$b);
> echo("b: ".$this->b);
> }
> }
>
> After proper initialisation, calling the function Show() gives:
>
> a:
> a: 2
> b:
> b: 5
>
> What am I forgetting here? Tia for answers!
>
> --
> Kind regards,
> Tim