Hi Paul,

Am 15.01.2009 um 20:35 schrieb Paul Biggar:

I suspect neither bug nor feature. I think you expect that
    $this->$propertyName['bar']
is the same as:
    ($this->$propertyName)['bar']
but in fact it is:
    $this->($propertyName['bar'])

So in your example, 'bar' is the string index 0 for "foo"[0], hence 'f'.

okay, I already suspected something like that but had already suppressed
that $string[0] works equally as $string{0}.

It has been pointed out before that one should be able to index an
expression, but currently PHP can only index variables. Personally, it
seems like a bug, but I'm not sure whether or not there's consensus.

IMO it feels like a bug, although I now understand the reasons.

What was the reason again to deprecate curly brackets access in PHP6? It
would make the situation clearer in the above example if square brackets
would be deprecated instead ...

Anyway, thank you for the clarification.

Robert


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to