Hi guys,
I'm looking to write a recursive php function that would call a function to generate nested HTML blocks ( not necessarily only DIVs ). So for example, for the following array:
$a = array(
'b' => 'b value',
'c' => 'c value',
'd' => array(
'd1' => array(
'd12' = 'd12 value'
),
'd2' => 'd2 value'
),
'e' => 'e value'
);
and the following function
function block( $key ) {
return '<div>'.$key.'</div>';
}
would result into
<div>
key - b
</div>
<div>
key - c
</div>
<div>
key - d
<div>
key - d1
<div>
key - d12
</div>
</div>
<div>
key - d2
</div>
</div>
<div>
key - e
</div>