Bug #79422 [Opn->Sus]: Feature request - allow to append multiple elements to an array

From: Date: Sat, 28 Mar 2020 22:42:16 +0000
Subject: Bug #79422 [Opn->Sus]: Feature request - allow to append multiple elements to an array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226298@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79422&edit=1 ID: 79422 Updated by: requinix@php.net Reported by: michael dot vorisek at email dot cz Summary: Feature request - allow to append multiple elements to an array -Status: Open +Status: Suspended Type: Bug Package: Scripting Engine problem PHP Version: 7.4.4 Block user comment: N Private report: N New Comment: This is not the place to make language suggestions. Check out the RFC process at https://wiki.php.net/rfc/howto Previous Comments: ------------------------------------------------------------------------ [2020-03-27 19:57:06] michael dot vorisek at email dot cz Description: ------------ 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 very sloop so it is not a solution. which I propose to shorten to: $res = []; foreach ($arr as $i) { $res[...] = make_res($i); } Appending multiple elements to an array is very common use-case. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79422&edit=1

« previous php.bugs (#226298) next »