我想重置以上内容。
$_REQUEST['some_number'] => Array
(
[0] => 1
[0_1] => 2
[0_2] => 3
[2] => 7
[2_1] => 8
[3] => 9
[3_1] => 10
)
到
$_REQUEST['some_number'] => Array
(
[0] => 1
[0_1] => 2
[0_2] => 3
[1] => 7
[1_1] => 8
[2] => 9
[2_1] => 10
)
我使用了array_values
print_r(array_values($_REQUEST['some_number']))
;
我得到了
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 7
[4] => 8
)
答案 0 :(得分:0)
我想你是这样问的
$samp = array("0" => 1,
"0_1" => 2,
"0_2" => 3,
"2" => 7,
"2_1" => 8,
"3" => 9,
"3_1" => 10 );
$samp2 = $samp;
$i=0;
$j=0;
$samp = array();
foreach($samp2 as $values)
{
if($j != 0)
$samp[$i."_".$j] = $values;
else
$samp[$i] = $values;
if($j > 1)
{
$i++;
$j=0;
}
else
$j++;
}
print_r($samp);