Re: $this->$string[char] bug?
| From: | Ryan Adams | Date: | Tue, 06 Jun 2000 13:56:44 +0000 |
| Subject: | Re: $this->$string[char] bug? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-1131@lists.php.net to get a copy of this message | ||
Hi,
It seems that to access variables in classes, one does not need a '$' after the
-> operator. I'm supposing that this is because of variable functions...
i.e.
class Foo {
var $blah = "stuff";
function Foo() {
echo $this->blah[0];
}
}
hope this helps,
Ryan
On Tue, Jun 06, 2000 at 12:04:30AM -0600, David Phillips wrote:
> I think I found a bug in PHP. You cannot access the invidual characters of a
> string if it is a class member variable using the $this pointer. I was
> unable to find a syntax that would
> make it work. It does not seem to be documented anywhere. Example:
>
> class Foo
> {
> var $blah = "stuff";
>
> function Foo()
> {
> echo $this->$blah[0]; // this will NOT work
>
> $str = $this->$blah;
> echo $str[0]; // this works
> }
> }
>
> --
> David Phillips <david@acz.org>
> http://www.acz.org/
>
> _____________________________________________
> NetZero - Defenders of the Free World
> Click here for FREE Internet Access and Email
> http://www.netzero.net/download/index.html
>
> --
> 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
---end quoted text---