Concatenate values of n arrays in php
You can put all word arrays into one array and use a recursive function like this: function concat(array $array) { $current = array_shift($array); if(count($array) > 0) { $results = array(); $temp = concat($array); foreach($current as $word) { foreach($temp as $value) { $results[] = $word . ‘ ‘ . $value; } } return $results; } else … Read more