function arrayCombineRecursive($keys, $values, $recursiveNamesArray = []): array
{
$result = [];
$array = [];
$j = 0;
foreach ($keys as $i => $k) {
if (in_array($k, $recursiveNamesArray)) {
$j++;
$array[$k][$j] = $values[$i];
} else {
$result[$k][] = $values[$i];
}
}
array_walk($result, create_function('&$v', '$v = (count($v) == 1)? array_pop($v): $v;'));
return array_merge($result, $array);
}