Re: Regarding array_shift()/array_unshift()

From: Date: Thu, 03 Jun 2021 09:31:09 +0000
Subject: Re: Regarding array_shift()/array_unshift()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-114704@lists.php.net to get a copy of this message
On 2021-06-03 01:59, Mike Schinkel wrote:
1.) Given Nikita's position that it would only be viable to offer a syntax that simulates method calling for arrays if the methods themselves are immutable can you envision a solution for allowing $array->shift() functionality that would address getting both element and shifted array without resorting to by-reference parameters?
Spread operator support in assignments would solve this nicely: [$first, ...$rest] = $array; -- Lauri Kenttä

« previous php.internals (#114704) next »