I have a foreach loop returning duplicate entries from a array string without duplicates inside it.
The code:
$a = [];
$b = [];
foreach($categories['results'][0]['parameters'] as $key => $value) {
if(in_array($value['code'], $input_valid_names)) {
if($value['type'] == 'input') {
$a = $value['code'];
$b = $PostData[$value['code']];
}
if($value['type'] == 'select'){
$a = $value['code'];
$b = $PostData[$value['code']];
}
if($value['type'] == 'checkbox' && !empty($PostData[$value['code']])){
$a = $value['code'];
$b = 'Sim';
}
$param[] = [$a => $b];
}
}
Any idea why its doing it? Made several debug but no clue...