I want to print the categories recursively. I don't know how many child the parent category have and so on for childs. Actually its a tree structure.
This code snipped help me to print dynamic arrays try this one:
function makeNestedList(array $Array){
$Output = '<ul>';
foreach($Array as $Key => $Value){
$Output .= "<li><strong>{$Key}: </strong>";
if(is_array($Value)){
$Output .= makeNestedList($Value);
}else{
$Output .= $Value;
}
$Output .= '</li>';
}
$Output .= '</ul>';
return $Output;
}
$Data = array("Some Info" => array("A" => "a", "B" => array("B1" => "b1", "B2" => "b2"), "C" => array("C1" => array("C11" => "c11", "C12" => "c12", "C13" => array("C131" => "c131", "C132" => "c132")), "C2" => "c2")));
echo makeNestedList($Data);