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

From: Date: Fri, 27 Mar 2020 19:57:06 +0000
Subject: Bug #79422 [NEW]: Feature request - allow to append multiple elements to an array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226289@lists.php.net to get a copy of this message
From: michael dot vorisek at email dot cz Operating system: PHP version: 7.4.4 Package: Scripting Engine problem Bug Type: Bug Bug description:Feature request - allow to append multiple elements to an array 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 bug report at https://bugs.php.net/bug.php?id=79422&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79422&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79422&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79422&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79422&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79422&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79422&r=support Expected behavior: https://bugs.php.net/fix.php?id=79422&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79422&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79422&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79422&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79422&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79422&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79422&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79422&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79422&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79422&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79422&r=mysqlcfg

« previous php.bugs (#226289) next »