I have the following array set in a php script and i am trying to get it to output as per the code below. I have tried looping but i am at a loss as to how i get it to show the sub arrays. I am hoping someone can help me.
PHP Array
$fruits = array();
$fruits[] = array('type' => 'Banana', 'code' => 'ban00');
$fruits[] = array('type' => 'Grape', 'code' => 'grp01');
$fruits[] = array('type' => 'Apple', 'code' => 'apl00',
array('subtype' => 'Green', 'code' => 'apl00gr'),
array('subtype' => 'Red', 'code' => 'apl00r')
);
$fruits[] = array('type' => 'Lemon', 'code' => 'lem00');
Desired Output
<ul>
<li><input type="checkbox" name="fruit" value="Banana"> Banana</li>
<li><input type="checkbox" name="fruit" value="Grape"> Grape</li>
<li>Apple
<ul>
<li><input type="checkbox" name="fruit" value="Green"> Green</li>
<li><input type="checkbox" name="fruit" value="Red"> Red</li>
</ul>
</li>
<li><input type="checkbox" name="fruit" value="Lemon"> Lemon</li>
</ul>