recursive script with infinite loop in an array to create menu with sub-options

0

I'm having trouble creating a function or recursive script for the array below, so it gets in an infinite loop to create a menu with infinite submenus, just like the Wordpress categories. In PHP

As long as you have the 'sub' key in the array,> create sub sub-options only as long as you have this index

  • .......
  •         
  • .......
  •         
  • .......
  •         
  • .......
  •         
  •             (I.e.                
    • .......
    •                         
    • .......
    •                         
    •                            (I.e.                              
      • .......
      •                                     
      • .......
      •                                     
      • .......
      •                                     
      • .......
      •                                     
      • .......                                            
        • .......
        •                                                     
        • .......                                                          
        •                                             
      •                             
    •                         
    • .......
    •                         
    • .......
    •                 
$config = array(
    'menu' => array(
        'option1'=array(
            'label'=>,
            'icon'=>,
            'href'=>,
            'class'=>,
            'id'=>,
            'attr'=>,
            'sub' => array(
                'label'=>,
                'icon'=>,
                'href'=>,
                'class'=>,
                'id'=>,
                'attr'=>,
                  'sub' => array(
                  'label'=>,
                  'icon'=>,
                  'href'=>,
                  'class'=>,
                  'id'=>,
                  'attr'=>,
                  ),
            ),
        ),
      'option2' = array(
            'label'=>,
            'icon'=>,
            'href'=>,
            'class'=>,
            'id'=>,
            'attr'=>,
            'sub'=>array(
                'option1'=array(
                      'label'=>,
                      'icon'=>,
                      'href'=>,
                      'class'=>,
                      'id'=>,
                      'attr'=>,
                  ),
            ),
       ),
    ),
);
    
asked by anonymous 03.06.2017 / 02:04

0 answers