Re: Classes

From: Date: Wed, 09 Apr 2003 15:00:16 +0000
Subject: Re: Classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-143096@lists.php.net to get a copy of this message
Remco Brouwer wrote:
Hi all, why is the output of this code : Hi Hi Thx in advance, R.Brouwer
Too many $
---------start--------- class a { var $text1; var $text2; function SetText1($text) { $this->$text1 = $text; $this->text1 = $text;
} function SetText2($text) { $this->$text2 = $text; $this->text2 = $text;
} } class b extends a { function Test() { $this->SetText2("Hi"); echo $this->$text1 . "<br>"; echo $this->$text2 . "<br>"; echo $this->text1 . "<br>";
echo $this->text2 . "<br>";
} } $a = new b; $a->test(); ---------end--------- Hi Hi


« previous php.general (#143096) next »