RE: [PHP] Class and extends pb/bug? with php404pl1

From: Date: Tue, 22 May 2001 10:00:07 +0000
Subject: RE: [PHP] Class and extends pb/bug? with php404pl1
Groups: php.general 
Request: Send a blank email to php-general+get-53836@lists.php.net to get a copy of this message
use $this->foo1 no double dollar signs. Otherwise PHP thinks you are trying to do variable variables thing. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: Hugues BRUNEL [mailto:hugues.brunel@synaptique.com] Sent: Tuesday, May 22, 2001 6:55 PM To: php-general@lists.php.net Subject: [PHP] Class and extends pb/bug? with php404pl1 I use PHP 4.0.4pl1 and I don't understand why this doesn't work. Does somebody help me ? class a { var $foo1 ; function a($thefoo) { $this->$foo1 = $thefoo ; echo "a::foo1=".$this->$foo1."\n" ; } } class b extends a { var $foo2 ; function b($thefoo1, $thefoo2) { $this->a($thefoo1) ; $this->$foo2 = $thefoo2 ; echo "b::foo1=".$this->$foo1."\n" ; echo "b::foo2=".$this->$foo2."\n" ; } } $toto = new b(1,3) ; echo "FOO1=".$toto->$foo1."\n" ; echo "FOO2=".$toto->$foo2."\n" ; The result is: a::foo1=1 b::foo1=3 <- (and not 1) ??? b::foo2=3 FOO1=3 <- (and not 1) ??? FOO2=3 Many thanks for any information (perhaps I'm very tired and I understand nothing??) Hugues. -- Synaptique Europe www.synaptique.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#53836) next »