Re: Object/Class problem

From: Date: Wed, 17 Oct 2001 15:38:00 +0000
Subject: Re: Object/Class problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71342@lists.php.net to get a copy of this message
"Jürgen" wrote: > > Hello, > > I have a really stupid problem, > can anybody explain me why this code doesn't work? > > The output on the website is "worldworld" in stead of "hello world". > Why? > > Thanks, > Jürgen Sturm > > $test = new Test(); > $test->$v1 = "hello "; > $test->$v2 = "world"; > echo $test->$v1 . $test->$v2; > > class Test { > var $v1, $v2; > > } > Try this: $test = new Test(); $test->v1 = "hello "; $test->v2 = "world"; echo $test->v1 . $test->v2; $test->$v1 is not the same as $test->v1. -- Pavel a.k.a. Papi

« previous php.general (#71342) next »