i have made a recursion function to show navigation scheme in tree form i am using recursion in codeigniter but this gives error as un-defined function my code is
function parseAndPrintTree($root, $tree)
{
$return = array();
if(!is_null($tree) && count($tree) > 0)
{
echo 'ul';
foreach($tree as $child => $parent)
{
if($parent == $root)
{
unset($tree[$child]);
echo 'li'.$child;
return parseAndPrintTree($child, $tree); // Recursion-here(Not called)
echo 'closing li';
}
}
echo 'closing ul';
}
}
i passed root and flat array to this function and got undefined behaviour..
what is right way to call function recursively in code-igniter controller
Error::
Fatal error: Call to undefined function parseAndPrintTree()