I need to concatenate each value of an array to every other value in another array in PHP
. For example:
$arr1 = ['A', 'B'];
$arr2 = ['CDE', 'F'];
$result = $arr1 * $arr2;
// $result = ['ACDE', 'AF', 'BCDE', 'BF'];
I can implement it by using nested foreach
but is there any inbuilt or quicker way to achieve this? As far as I've searched, I could find only array_map
which concatenates only same indexes.