Can you help me with generating caresian product. It is similar to this stackoverflow. I want generate inputs so I need keep ID.
Example:
my input data:
[
1 => [
id => 1,
name => "Color",
options => [
5 => [
id => 5,
name => "Red"
],
6 => [
id => 6,
name => "Blue"
]
]
],
2 => [
id => 2,
name => "Size",
options => [
7 => [
id => 7,
name => "S"
],
8 => [
id => 8,
name => "M"
]
]
],
// etc
]
result I expect:
[
"5-7" => "Red / S",
"5-8" => "Red / M",
"6-7" => "Blue / S",
"6-8" => "Blue / M"
]
I need generic function for any number of properties/options..