Re: Object/Class problem
| From: | DL Neil | Date: | Wed, 17 Oct 2001 15:48:09 +0000 |
| Subject: | Re: Object/Class problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71349@lists.php.net to get a copy of this message | ||
> 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;
>
> }
Tag Jurgen,
Class attributes do not require the variable-$ symbol when used after a pointer.
eg $test->v1 = "hello ";
Regards,
=dn