Re: [RFC]Call for voting about const array/string dereference
| From: | Ferenc Kovacs | Date: | Tue, 27 Dec 2011 14:53:30 +0000 |
| Subject: | Re: [RFC]Call for voting about const array/string dereference | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-57121@lists.php.net to get a copy of this message | ||
On Tue, Dec 27, 2011 at 2:42 PM, Dmitri Snytkine <
dsnytkine@ultralogistics.com> wrote:
> Odd how substring can be used as index of string.
oh, I see where the confusion comes from.
the reason why "foobar"["foo"] returns 'f' isn't that
"foo" is a substring
of "foobar", but that "foo" will be casted to int, which will result in
"foobar"[0], which in turn will result in 'f'
and "foobar"["3 apples"] would return 'b' for example.
it's an unexpected behavior for many people, but it is how it works and we
even documented this.
as I mentioned in my previous mail, we will try to make this a little bit
more noisy, as this can lead to hard to spot bugs.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu