如何从动态数量的Div字段获取POST方法的值 - PHP

Imagine this div; this div will be duplicated using an add more button according the user preference.

<div id='work'>
    <input type="text" placeholder="x" name="work_x[]" />
    <input type="text" placeholder="y" name="work_y[]" />
    <input type="text" placeholder="z" name="work_z[]"/>
</div>

Sample input data would be:

IT intern
ABC solutions
6 Months

Jr IT exec
CDE company
1 year

etc...

On submit In the backend using PHP I need to get the values to an array such as:

[[IT intern , ABC solutions, 6 Months] , [Jr IT exec, CDE company, 1 year]]

Any help would be appreciated.

Assuming the first input (work_x) is mandatory, like this it should be good :

$i=0;
$data=[];
foreach($_POST['work_x'] as $val) {
    $data[$i]['work_x'] = $val;
    $data[$i]['work_y'] = $_POST['work_y'][$i];
    $data[$i]['work_z'] = $_POST['work_z'][$i];
    $i++;
}

or simpler and without named keys in array

$i=0;
$data=[];
foreach($_POST['work_x'] as $val) {
    $data[] = [$val, $_POST['work_y'][$i], $_POST['work_z'][$i]];
    $i++;
}