Is it possible to combine the arrays?

Is it possible to merge the contents of arrays, if the key is already used for something for nothing, and if not - then you need to add the other arrays, but with an empty value
array(3) {
[0]=>
 array(4) {
 ["attributes_3_ru-EN"] => "10"
 ["attributes_3_en-gb"] => "100"
 ["attributes_4_en-gb"] => "2222"
 ["attributes_4_ru-EN"] => ""
}
[1]=>
 array(2) {
 ["attributes_6_ru-EN"] => "10"
 ["attributes_6_en-gb"] => "100"
}
}
[2]=>
 array(2) {
 ["attributes_4_ru-EN"] => "10"
 ["attributes_4_en-gb"] => "100"
}
...n
}

That would get output something like this
array(3) {
[0]=>
 array(4) {
 ["attributes_3_ru-EN"] => "10"
 ["attributes_3_en-gb"] => "100"
 ["attributes_4_en-gb"] => "2222"
 ["attributes_4_ru-EN"] => ""
 ["attributes_6_ru-EN"] => ""
 ["attributes_6_en-gb"] => ""
}
[1]=>
 array(2) {
 ["attributes_6_ru-EN"] => "10"
 ["attributes_6_en-gb"] => "100"
 ["attributes_3_ru-EN"] => ""
 ["attributes_3_en-gb"] => ""
 ["attributes_4_en-gb"] => ""
 ["attributes_4_ru-EN"] => ""
}
}
[2]=>
 array(2) {
 ["attributes_4_ru-EN"] => "10"
 ["attributes_4_en-gb"] => "100"
 ["attributes_6_ru-EN"] => ""
 ["attributes_6_en-gb"] => ""
 ["attributes_3_ru-EN"] => ""
 ["attributes_3_en-gb"] => ""
}
...n
}
June 5th 19 at 21:34
2 answers
June 5th 19 at 21:36
The addition of arrays.
$array_one + $array_two...
June 5th 19 at 21:38
$arr_finished = $arr1 + $arr2 + $arr3 + ...
$arr_finished = array_walk($arr_finished, function(&$v, $k) {
 $v = isset($arr1[$k]) ? $arr1[$k] : "";
});

Find more questions by tags ArraysPHP