note 123530 added to function.array-push
| From: | CarlosAlbertoB.Carucce@php.net | Date: | Fri, 18 Jan 2019 16:34:53 +0000 |
| Subject: | note 123530 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210077@lists.php.net to get a copy of this message | ||
This is how I add all the elements from one array to another:
<?php
$oneArray = ['d', 'e', 'f'];
$anotherArray = ['a', 'b', 'c'];
array_push($anotherArray, ...$oneArray);
//['a', 'b', 'c', 'd', 'e', 'f'];
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.35 (proxied: 187.183.37.42)
----
Manual Page -- http://php.net/manual/en/function.array-push.php
Edit -- https://master.php.net/note/edit/123530
Del: integrated -- https://master.php.net/note/delete/123530/integrated
Del: useless -- https://master.php.net/note/delete/123530/useless
Del: bad code -- https://master.php.net/note/delete/123530/bad+code
Del: spam -- https://master.php.net/note/delete/123530/spam
Del: non-english -- https://master.php.net/note/delete/123530/non-english
Del: in docs -- https://master.php.net/note/delete/123530/in+docs
Del: other reasons-- https://master.php.net/note/delete/123530
Reject -- https://master.php.net/note/reject/123530
Search -- https://master.php.net/manage/user-notes.php