从动态表单帖子中收集和格式化数据

I'm working on a web project and one thing I need to know is how to get the number of a array item and use that number to get an item from a different array, I've setup a page to dynamically add Bootstrap Panels with 2 input boxes in them.

<div class="panel panel-default">
    <div class="panel-heading">
        <a data-toggle="collapse" data-parent="#accordion" href="#<?php echo $index; ?>">
            <h4 class="panel-title">
                <?php echo $menu[0]; ?> <b class="caret pull-right"></b>
            </h4>
        </a>
    </div>
    <div id="<?php echo $index; ?>" class="panel-collapse collapse">
        <div class="panel-body">

            <div class="form-group">
                <label for="menu_name[]">Name:</label>
                <input id="menu_name[]" name="menu_name[]"placeholder="Name">
            </div>

            <div class="form-group">
                <label for="menu_link[]">Link:</label>
                <input id="menu_link[]" name="menu_link[]" value="<?php echo $menu[1]; ?>" placeholder="URL">
            </div>

            <div class="btn-group pull-right">
                <button class="btn btn-danger" type="submit" name="delete" value="<?php echo $index; ?>"><i class="fa fa-trash"></i> Delete</button>
            </div>

        </div>
    </div>

This form is for adding menus to create an array with each menu item's text and link and when I submit the form this is the result I get:

[["Home", "News"], ["http://localhost/", "http://localhost/news/"]]

But I want to format the array so that each menu item in an individual array instead of splitting the 2 options between arrays, here's an example of the output I want to achieve:

[["Home", "http://localhost"], ["News", "http://localhost/news"]]

I'm not sure how to do this and I've looked all over trying to find a solution or example to help but I can't find anything, I was doing some research on array_search but I'm not sure if that's what I want.

If im not wrong about problem, this's the solution.

$json = '[["Home", "News"], ["http://localhost/", "http://localhost/news/"]]';

list($names, $links) = json_decode($json);

for ($k=0; $k<count($names); $k++)
    echo sprintf('Link is "%s" for "%s"', $links[$k], $names[$k]).PHP_EOL;

UPDATE

$json = '[["Home", "News"], ["http://localhost/", "http://localhost/news/"]]';
$output = array();

list($names, $links) = json_decode($json);

for ($k=0; $k<count($names); $k++)
   $output[] = array($names[$k], $links[$k]);

Then you can see array with print_r function.

print_r($output);

And the json with json_encode

echo json_encode($output);