Answer the question
In order to leave comments, you need to log in
How can you merge 3D arrays?
Good evening. There are two arrays:
$arr1 = array(
array( 3 , array (6, 7, 8 )),
array( 6 , array (5, 6, 8 )),
array( 15 , array (5, 12, 13 )) ,
array( 16 , array (2, 3, 21, 22 ))
);
$arr2 = array(
array( 1 , array ( 9, 15 )),
array( 6 , array ( 7 ))
);
It is necessary to combine them, leaving the data from the first and adding from the second.
$arr3_result= array(
array( 1 , array ( 9, 15 )),
array( 3 , array (6, 7, 8 )),
array( 6 , array (5, 6, 7, 8 )),
array( 15 , array (5, 12, 13 )),
array( 16 , array (2, 3, 21, 22 ))
);
How can they be combined like that? I drew schemes for iterating through foreach, but it turns out so cumbersome that I myself can’t figure it out later in this garden.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question