Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-30 Thread Nikita Popov
On Sun, Mar 29, 2020 at 12:07 AM Michael Voříšek - ČVUT FEL < voris...@fel.cvut.cz> wrote: > Hi all PHP gurus! > > This is a feature request / RFC for the following use-case: > > $res = []; > foreach ($arr as $i) { > foreach (make_res($i) as $v) { > $res[] = $v; > } > } > > Array_merge in loop is

RE: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-29 Thread Iván Arias
>> $arr[] = 1, 2, 3; // push these 3 values >> $arr[] = 1, 2, ... [3, 4, 5], 6; // push these 6 values > >Just to play with this... - normally an assignment evaluates to the >value being assigned: > >var_dump($arr[] = 1); // int(1) > >What would this produce? > >var_dump($arr[] = 1, 2, 3); > >The f

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-29 Thread Jakob Givoni
On Sun, Mar 29, 2020 at 4:08 AM Iván Arias wrote: > > $arr[] = 1, 2, 3; // push these 3 values > $arr[] = 1, 2, ... [3, 4, 5], 6; // push these 6 values Just to play with this... - normally an assignment evaluates to the value being assigned: var_dump($arr[] = 1); // int(1) What would this prod

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-29 Thread Manuel Canga
Hi, Internals > > Em sáb., 28 de mar. de 2020 às 20:07, Michael Voříšek - ČVUT FEL < > voris...@fel.cvut.cz> escreveu: > > > Hi all PHP gurus! > > > > This is a feature request / RFC for the following use-case: > > > > $res = []; > > foreach ($arr as $i) { > > foreach (make_res($i) a

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-29 Thread Iván Arias
lt;https://aka.ms/ghei36> From: David Rodrigues Sent: Sunday, March 29, 2020 5:32:32 AM To: Michael Voříšek - ČVUT FEL Cc: PHP Internals Subject: Re: [PHP-DEV] Feature request - allow to append multiple elements to an array I think it useful, despite that it co

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread David Rodrigues
I think it useful, despite that it could be done by using array_push() as Woortmann said. Anyway, I think valid a new proposal for thinks like that. But I will suggests this: $arr[] = ... $items; Atenciosamente, David Rodrigues Em sáb., 28 de mar. de 2020 às 20:07, Michael Voříšek - ČVUT FEL

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread Enno Woortmann
Hi Michael, why not simply use array_push with multiple arguments? Something like: $a = []; array_push($a, ...array_fill(0, 10, 'x')); echo print_r($a, true); Cheers, Enno Am 29.03.2020 um 00:07 schrieb Michael Voříšek - ČVUT FEL: Hi all PHP gurus! This is a feature request / RFC for the foll