PHP concatenates arrays into one big array

Is it possible to concatenate the arrays and basically add them to one big array like this:

$a = array(1,2,3,4);
$b = array(5,6,7,8);
$c = array(1,2,3,4);

      

so that the output is as follows:

$result = array(1,2,3,4,5,6,7,8,1,2,3,4);

      

Is it possible?

Thanks for the help!

+3


source to share


1 answer


http://php.net/manual/en/function.array-merge.php

$a = array(1,2,3,4);
$b = array(5,6,7,8);
$c = array(1,2,3,4);

$out = array_merge($a, $b, $c);

      



Result:

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
    [6] => 7
    [7] => 8
    [8] => 1
    [9] => 2
    [10] => 3
    [11] => 4
)

      

+19


source







All Articles