Re: Proposal for deprecate alternate syntax(curly braces) for array and string access
| From: | Rowan Collins | Date: | Fri, 15 Mar 2019 18:08:22 +0000 |
| Subject: | Re: Proposal for deprecate alternate syntax(curly braces) for array and string access | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104759@lists.php.net to get a copy of this message | ||
On Fri, 15 Mar 2019 at 17:53, Levi Morrison <levim@php.net> wrote:
> 1. I cannot think of *any* reason to separate them. If you want to
> make sure you are indexing a string, *do a type check*, not bake
>
{}
> into only working on strings.
>
I think it's more common to do the opposite: think you're working on an
array, and accidentally pick up a string.
If we separated the syntaxes, it would be possible to always raise a
warning when that happens, rather than silently returning the Nth character.
To be honest I can't remember the last time I used *either* syntax for
string access, other than by accident.
Regards,
--
Rowan Collins
[IMSoP]