Re: $myobject->$$varname doens't work ??
| From: | Aidan Lister | Date: | Sun, 09 May 2004 08:34:57 +0000 |
| Subject: | Re: $myobject->$$varname doens't work ?? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185733@lists.php.net to get a copy of this message | ||
Ooops, actually he was pretty ambiguous, please disregard my previous
comment :)
"Richard Harb" <rharb@earthling.net> wrote in message
news:1591097819.20040509095526@earthling.net...
> Try
> echo $obj->$varname;
>
>
> -----Original Message-----
> From: greg
> Sent: Sunday, May 9, 2004, 9:21:52 AM
> > Hello,
>
> > I was just trying this but it doesn't work :
> > <?php
>
> > class a {
> > public $foo = "hello world";
> > }
>
> > $obj = new a();
> > $varname = "foo";
> echo $obj->>$$varname;
>
> > $bar = "this is working";
> > $varname = "bar";
> > echo $$varname; // display "this is working" as expected
> ?>>
>
> > Is it a bug or is it normal ?
> > I didn't find anything about it in documentation (php4 / php5).
>
> > Greg