i am in some confusion.what i am trying to do is:-

i have a form in multiples can posted in smae input field as shown name attribute is taken as array-
<input type="text" class="form-control" placeholder="Enter" name="a[]">
now this input can duplicated on clicking add more button and input area is cloned so ,we can collect all values in array posted.

But this input field has one more option add-sub-option

eg form opened there is one input area addoption there is button near which is add more option so that input field can cloned but this input area has also add sub option button i.e** each options can have many sub options** and this option can have itself have values .eg take above menu bar each navbar item is option and each this option has sub-child or sub menu item.

so for sub menu i have this-
<input name="submenu[]" type="text" class="form-control" placeholder="Sub Menu">

i have posted values and form values posted are below

i have menu1 which has 1,2 as sub menu,menu2 is another menu having 3,4 as sub menu now question is how can i map after form submission that this option has these sub menu values??

C:\xampp\htdocs\ADM\admin\php\addmenu.php:25:
array (size=2)
  0 => string 'menu1' (length=5)
  1 => string 'menu2' (length=5)

C:\xampp\htdocs\ADM\admin\php\addmenu.php:26:
array (size=4)
  0 => string '1' (length=1)
  1 => string '2' (length=1)
  2 => string '3' (length=1)
  3 => string '4' (length=1)

what i also want is array to be build like this

array (size=2)
      0 => string 'menu1'  (length=5) array (
      0=>1 --->sub menu
      1=>2
      )
      1 => string 'menu2' (length=5) array(
      0=>3
      1=>4
      )