user2007265 user2007265 - 1 month ago 5
PHP Question

PHP: View all value of multiple array together

I want print all value of array together


Array :


$one = array('a','b');
$two = array('z','x');



Result :


az
ax
bz
bx


But i do not want use
foreach
:

foreach($one as $value){
foreach($two as $valueTwo){
echo $value.$valueTwo;
}
}


Because my
array
number are unknown


For sample :


array('a','b','c','d','e');
array('z','x','y');
array('1','2','3','4');
array('q','r','s');
array('t','5','j');
array('8','n');

Answer

Here is what you are looking for.

Finding cartesian product with PHP associative arrays

I put your sample here: DEMO

Comments