I wrote a simple php function to walk over a multidimensional array and print its content in a preformatted way. But the function doesn't go deep and only adds first-level leaf nodes to the text.
Can anyone please help to figure out the problem and the solution?
function LOP($arrayItself, $txt){
foreach($arrayItself as $fieldName=>$fieldValue){
if(is_array($fieldValue)){
LOP($fieldValue, $txt);
}
else {
$txt .= "<$fieldName> $fieldValue </$fieldName>";
}
}
return $txt;
}