I have string structured like
(cat,dog,fish) && (drinks) && (milk,water)
I need to convert to an array list like
cat drinks milk
cat drinks water
dog drinks milk
dog drinks water
fish drinks milk
fish drinks water
I've thought about doing it with a loop that takes each group and inserts them into an array like
0th pass: fill the array with the first row
(cat,dog,fish) && (drinks) && (milk,water)
1st pass: detect the first group and split it while removing the source
cat && (drinks) && (milk,water)
dog && (drinks) && (milk,water)
fish && (drinks) && (milk,water)
2nd pass ....
then loop this each time take the line split it add it to the end and remove the original.
Do you have a better idea? and in PHP?
For those who wonder It is part of sentence parsing code I'm writing.
Thanks