Is anybody know how to make a correct links(full path) to categories in case with multimenu below?

Is anybody know how to make a correct links(full path) to categories in case with multimenu below?Is anybody know how to make a correct links(full path) to categories in case with multimenu below?Is anybody know how to make a correct links(full path) to categories in case with multimenu below?Is anybody know how to make a correct links(full path) to categories in case with multimenu below?

<style>
nav ul
        {
        list-style: none;
        padding: 0;
        text-align:center;
        }
nav li
        {
        background-color: rgba(0,100,0,0.5);
        position: relative;
        display: inline-block;
        }
nav li:hover
        {
        background-color: rgba(100,0,0,0.5)
        }
nav a
        {
        display:block;
        padding: 0.5em;
        text-decoration: none;
        color: rgba(0,0,100,0.9);
        }
nav ul ul
        {
        display: none;
        position: absolute;
        }
nav li:hover > ul
        {
        display: block;
        }
nav ul ul ul
        {
        left: 100%;
        top: 0;
        }
nav > ul > li > ul > li
        {
        min-width: 100%;
        }
        
        </style>


<?php



function is_multidimensional(array $array) {
    return count($array) !== count($array, COUNT_RECURSIVE);
}



function printArrayList($array, $last)
{
    
    $pathstring ="";

    echo "<ul>n"; 

    foreach ($array as $k => $v)
    {
        $path[]=$k;
    
        if (is_array($v))
        {   
    
     $path[]=$last; $fullPath = implode("/", $path);
    
            echo "<li><a href=".$fullPath.">" . $k . "</a>n";   //echo "<li><a href=''>" . $k . "</a></li>n";
            
             if (is_multidimensional($v)) { printArrayList($v, $k); } else { }
             
            
            continue;
            
        }
if (strpos($k, "option")>0) {
        } else { echo "<li>" . $k . " " . $v . ""; }   //   } else { echo "<li>" . $k . " " . $v . "</li>"; }
    
    }

    echo "</ul>n";
}






$menu = array(
    'Cat1' => array(
        'FORCATEGORY_NUMBER1_option' => "1",
        'FORCATEGORY_NUMBER2_option' => "2",
        'FORCATEGORY_NUMBER3_option' => "3",
        "ITEMS1" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "111",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
        ),

         "ITEMS2" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
        ),
        
    ) ,
        'Cat2' => array(
        'FORCATEGORY_NUMBER1_option' => "1",
        'FORCATEGORY_NUMBER2_option' => "2",
        'FORCATEGORY_NUMBER3_option' => "3",
        "ITEMS1" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
        ),

         "ITEMS2" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
        ),
        
    ) ,
    
     'Cat2' => array(
        'FORCATEGORY_NUMBER1_option' => "1",
        'FORCATEGORY_NUMBER2_option' => "2",
        'FORCATEGORY_NUMBER3_option' => "3",
        "ITEMS1" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
        ),

         "ITEMS2" => array(
            'FORCATEGORY_NUMBER1_option' => "1",
            'FORCATEGORY_NUMBER2_option' => "2",
            'FORCATEGORY_NUMBER3_option' => "3",
            "Apples" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
                "Banans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
                      "BigBanans" => array(
                    'FORCATEGORY_NUMBER1_option' => "1",
                    'FORCATEGORY_NUMBER2_option' => "2",
            ),
            ),
        ),
        
    ) ,
);



?>



<nav>
<?PHP printArrayList($menu, $last="");


?>
</nav>