note 128356 added to function.array-merge

From: Date: Fri, 31 Mar 2023 06:18:51 +0000
Subject: note 128356 added to function.array-merge
Groups: php.notes 
Request: Send a blank email to php-notes+get-220314@lists.php.net to get a copy of this message
Using the spread operator with array_merge allows merging any number of arrays together in one operation: <?php array_merge(...$array_of_arrays); ?> Perhaps $array_of_arrays was built up in a loop, with $array_of_arrays[] = $another_array inside the loop. Collecting the arrays together this way and then merging them all at once is many times faster than repeatedly merging arrays two at a time (doing array_merge inside the loop). ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 125.239.194.160) ---- Manual Page -- https://php.net/manual/en/function.array-merge.php Edit -- https://main.php.net/note/edit/128356 Del: integrated -- https://main.php.net/note/delete/128356/integrated Del: useless -- https://main.php.net/note/delete/128356/useless Del: bad code -- https://main.php.net/note/delete/128356/bad+code Del: spam -- https://main.php.net/note/delete/128356/spam Del: non-english -- https://main.php.net/note/delete/128356/non-english Del: in docs -- https://main.php.net/note/delete/128356/in+docs Del: other reasons-- https://main.php.net/note/delete/128356 Reject -- https://main.php.net/note/reject/128356 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220314) next »