I have three arrays right now the values of which I want to combine together. All of the values have matching keys but I can't work out quite how to do it. To put it more visually I have:
array{
[0] => "Foo"
}
array{
[0] => " Bar"
}
and I want:
array{
[0] => "Foo Bar"
}
But for the life of me I can't figure out how! At first I thought about using nested foreach statements like
$result = array();
foreach ($array1 as &$input1) {
foreach ($array2 as &$input2) {
$result[] = $input1 . $input2;
}
}
But while that combined the values, it generated a lot of correct ones (The array was about twice the size as expected).