Re: Proposal for deprecate alternate syntax(curly braces) for array and string access

From: Date: Fri, 15 Mar 2019 13:43:38 +0000
Subject: Re: Proposal for deprecate alternate syntax(curly braces) for array and string access
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-104745@lists.php.net to get a copy of this message
On 15/03/2019 14:39, Andrey O Gromov wrote: > Reasons to deprecate curly braces syntax:: > 1. Two ways to do the same thing. > 2. It is very rarely used nowadays. > 3. It is almost not documented. There is only two short “NOTE” about > it. > 4. Also, this syntax has reduced functionality. You can't use it for > pushing element into array “$arr{} = 1;”, creating array “$a={1,2};” or in > other similar cases. > 5. Deprecation and following removal will free this syntax for other > features. For example: array/string slice, absolute offset access, > “windows” (like “slice” in GoLang), etc. > > Proposal > https://wiki.php.net/rfc/deprecate_curly_braces_array_access Do I understand it right, that you're proposing deprecating accessing $string{$offset}? I think that's an important way of differentiation between string and array offset access. I'd vote "yes" for splitting syntax on array and string offset access, but as is: -1. > > Patch diff > > https://github.com/php/php-src/compare/PHP-7.4...rjhdby:deprecate_alternate_array_access > > Migration script > V‚üÐj qç > °XÃhttps://github.com/rjhdby/php-src/blob/deprecate_alternate_array_access/convert_array_access_braces.php > -- Regards, Mike

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#104745) next »