I have \"attributes\" from database. Each attribute has many values. Now I want to mix these values to create unique combinations.
example of input:
you can use this: https://gist.github.com/jwage/11193216
or
use the code bellow:
$rightItem) {
$results[] = array_merge((array) $leftItem, (array) $rightItem);
}
}
return $results;
}
$y = $attributes[0];
foreach($attributes as $key => $attrs) {
if(isset($attributes[$key + 1]) && is_array($attributes[$key + 1])) {
$y = array_mix($y, $attributes[$key + 1]);
}
}
var_dump($y);