[TYPO3-core] Decisions and Changes to Coding Guidelines (CGL)

Stefan Neufeind typo3.neufeind at speedpartner.de
Fri Jan 31 11:20:56 CET 2014


On 01/31/2014 10:59 AM, Karsten Dambekalns wrote:
> Hi.
> 
> On 30.01.2014, at 20:45, JoH asenau <info at cybercraft.de> wrote:
> 
>>> so far I used $string[2], not with curly brackets. Do we want to
>>> use curly brackets to make clear that $string is not an array
>>> (and use the square-brackets for arrays)?
>> 
>> That was exactly the intention :-) There have been some rumours
>> though, that {} would be removed in future versions of PHP, but it
>> seems that this has been revoked already.
> 
> There was a time when rumors said [] was might be removed for
> strings, and {} was recommended. Then [] was going to stay and the
> use of {} is no longer recommended. The manual lists it as an
> alternative to [] in
> http://www.php.net/manual/en/language.types.string.php#language.types.string.substr
> and all examples use the [] syntax.
> 
>> IMHO it's a good idea to do it like that, since it won't confuse
>> newbies who might not be familiar with array access to strings.
> 
> Confusion was exactly the reason to no longer recommend using {} -
> because {} is used for the “Complex (curly) syntax” explained in
> http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing

I personally agree *not* to use curly syntax.


Kind regards,
 Stefan


More information about the TYPO3-team-core mailing list