Concatenate two arrays based on array1

I am trying to merge two arrays array1 for the values that are set

Array1 ( [0] => false [1] => 200 )
Array2 ( [0] => true [1] => 80 [2] => 60 [3] => 75 [4] => 50 [5] => 0 [6] => 0 [7] => 30 [8] => 40 ) 

      

for example an array of results:

Array3 ( [0] => false [1] => 200 [2] => 60 [3] => 75 [4] => 50 [5] => 0 [6] => 0 [7] => 30 [8] => 40 ) 

      

what would be an efficient way to handle this.

thanks

0


a source to share


1 answer


Use the array concatenation operator.



$array3 = $array1 + $array2;

      

+3


a source







All Articles