以下是变量:
$ids = array_unique($_POST['id']);
$total_ids = count($ids);
$name = $_POST['name'];
$positions = $_POST['position'];
$total_positions = count($positions);
这是 print_r 显示的内容:
[id] => Array (
[0] => 3
[1] => 7 )
[name] => Array (
[0] => George
[1] => Barack )
[position] => Array (
[1] => Array (
[0] => 01
[1] => 01 )
[2] => Array (
[0] => 01
[1] => 01
[2] => 01 ) )
这是我想在刷新/提交时得到的结果:
[id][0];
[name][0];
[position][1][0];[position][1][1]
[id][1];
[name][1];
[position][2][0];[position][2][1];[position][2][2]
为了使想要的结果很清楚:
User with [id][0]
is called [name][0]
and works at [position][1][0];[position][1][1]
BUT
User with [id][1]
is called [name][1];
and works at [position][2][0];[position][2][1];[position][2][2]
请注意,[position]
s 以 开头[1]
,而不是[0]
。
我怎样才能按我显示的顺序显示数组?