I have the following function I modified based off someone elses function:
function showCombinations($string, $nameString, $linkParts, $i){
$wordDivider = "/"; //the divider between the words/values
if ($i >= count($linkParts)){
echo "<a href='".trim($string)."'>".trim($nameString)."</a>, ";
} else {
foreach ($linkParts[$i] as $currentTrait){
if ($currentTrait['name']=="urltext"){
$currentNameStringName=""; //ignore
} else {
$currentNameStringName=$currentTrait['name'];
}
if ($nameString!=""){
$currentNameString=$nameString." - ".$currentNameStringName;
} else {
$currentNameString=$nameString.$currentNameStringName;
}
showCombinations($string.$currentTrait['value'].$wordDivider, $currentNameString, $linkParts, $i + 1);
}
}
}
showCombinations('', '', $linkParts, 0);
All I need to change this to do is, instead of "ECHO", I want it to build up the combination and so I can do:
$result = showCombinations('', '', $linkParts, 0);
echo $result;
I need it this way because I have to modify that $result, not just echo it.