Cartesian Product of multiple arrays associate with existing array php
$10-30 USD
货到付款
I want to generate a form table with all combinations between attribute and attribute values.
I use possible_combs() - function to generate them
function possible_combos($groups, $prefix='') {
$result = array();
$group = array_shift($groups);
foreach($group as $selected) {
if($groups) {
$result = array_merge($result, possible_combos($groups, $prefix .$selected.', '));
} else {
$result[] = [
'combination_string' => $prefix.$selected,
];
}
}
return $result;
}
BUT, i want to associate product_id for existing combs.
I want to know the logic behind this, how can i merge or find in comb_string to know when combination has product_id and when i have to create new one by adding product_id - 0.
项目ID: #19000616
关于项目
有2名威客正在参与此工作的竞标,均价$40/小时
Hi I'm an expert in php programming. I'm sure that I can easily do this project. We can have a about it. Thanks..