Re: Array spread append

From: Date: Fri, 07 Apr 2023 18:07:19 +0000
Subject: Re: Array spread append
Groups: php.internals 
Request: Send a blank email to internals+get-119831@lists.php.net to get a copy of this message
> I think it would be more intuitive to implement an array "appending" > functionality with "concatenating" syntax. The .= > syntax already exists, > but is forbidden from use on non-strings. If you want to implement this > preexisting syntax as an array concatenation operator, then it is a blank > slate -- you can decree whatever behaviors you wish for it without blurring > what the combined operator does with strings. on github there is a comment about adding an array_concat() instead like js's Array.concat() that would try to avoid the pitfalls of +=, array_push, and current behaviour of .= flipping through the mdn for it, its results seem alright.

« previous php.internals (#119831) next »