Cant use current function in function

Hello,

I want to display an array as an HTML ul. I found the following code:
[php]function makeULLI($array) {
$return = “

    \n”;
    if (is_array($array) && count($array) > 0) {
        foreach ($array as $k => $v) {
            if (is_array($v) && count($v) > 0) {
                $return .= "\t<li>" . $k . makeULLI($v) . "</li>\n";
            }
            else {
                $return .= "\t<li>" . $v . "</li>\n";
            }
        }
    } else {}
    
    $return .= "</ol>";
    
    return $return;
    

    }[/php]

    But when I run this i get:

    [b]Fatal error[/b]: Call to undefined function makeulli() in [b]/home/public_html/html_helper.php[/b] on line [b]313[/b]

    I am using it in a class.

    How can I solve this? Or do you maybe have an other idea how to print an array as an HTML UL?

    Thank you,
    Bart

it depends on how your calling the function, there also case sensitive makeULLI is not the same as makeulli.
provide the code that calls this function and I might be able to help you.

Sponsor our Newsletter | Privacy Policy | Terms of Service