I have two array like these:
$a = array("abc","defs","ghi");
$b = array("abcs","def","ghis");
I want all the combination of strings like these:
abc defs ghi
abc def ghi
abc def ghis
abc defs ghis
abcs defs ghi
abcs def ghi
abcs def ghis
abcs defs ghis
How to do this in php?
PS - array can be of any length but both arrays size are always same.
PPS - The accepted answer given in this question is not giving me the correct result. It is giving the following result:
Array ( [0] => Array ( [0] => abc [1] => abcs ) [1] => Array ( [0] => abc [1] => def ) [2] => Array ( [0] => abc [1] => ghi ) [3] => Array ( [0] => defs [1] => abcs ) [4] => Array ( [0] => defs [1] => def ) [5] => Array ( [0] => defs [1] => ghi ) [6] => Array ( [0] => ghi [1] => abcs ) [7] => Array ( [0] => ghi [1] => def ) [8] => Array ( [0] => ghi [1] => ghi ) )