Re: [RFC] Generalize support of negative string offsets
| From: | Stanislav Malyshev | Date: | Thu, 11 Feb 2016 06:27:20 +0000 |
| Subject: | Re: [RFC] Generalize support of negative string offsets | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91191@lists.php.net to get a copy of this message | ||
Hi!
> I just added support for '[]' on strings and '{}' to the PR.
>
> Examples :
>
> $string[] = 'a'; // equivalent to : $string[strlen($string)]
>
> $string{} = 'a'; // For consistency
That's probably not a good idea, and certainly is not good for the RFC -
the patch now does two unrelated things.
> This is not strictly in the scope of negative offsets. So, if you think
> it must be part of a separate RFC, I will remove it.
Yes, I think so. And I also thing it is a bad idea. We already have a
way to add stuff to the string - it's .= operator. Adding another weird
way to do it IMO is not good.
--
Stas Malyshev
smalyshev@gmail.com