我有以下数据
Array ( [0] => Array ( [operations] => Array ( [0] => Array ( [method] =>
POST)))
Array ( [1] => Array ( [operations] => Array ( [0] => Array ( [method] => POST))))
我想像这样发誓
Array ( [operations] => Array ( [0] => Array ( [method] => POST)))
如何删除数组的第一个索引
我正在使用以下代码,但它不适用于多个数组
$key = array_shift($array);
答案 0 :(得分:0)
我想我终于得到了你的追求。试试这个,看看它能不能得到你想要的东西:
$array = Array (
array('0' => Array ( 'operations' => Array ( '0' => Array ( 'method' => POST)))),
array('1' => Array ( 'operations' => Array ( '0' => Array ( 'method' => POST))))
);
foreach($array as $key=>$value){
$results[$key]['operations'] = $array[$key][$key]['operations'];
}
print_r($results);
这将输出:
Array
(
[0] => Array
(
[operations] => Array
(
[0] => Array
(
[method] => POST
)
)
)
[1] => Array
(
[operations] => Array
(
[0] => Array
(
[method] => POST
)
)
)
)