我想修复php数组。
亲爱我的阵列如下:
$stmyarr=Array ( [0] => [0]=>aaa,[1]=>ddd,[2]=>bbb,[3]=>ccc)
我想删除[0] =>
显示为
时的结果Array ([0]=>aaa,[1]=>ddd,[2]=>bbb,[3]=>ccc)
怎么做?
答案 0 :(得分:4)
简单,只需将数组名称重新分配给[0]
// after your original $stmyarr
$stmyarr = array(0 => array( 0 => 'aaa', 1 => 'ddd', 2 => 'bbb', 3 => 'ccc'));
$stmyarr = $stmyarr[0];
print_r($stmyarr);
结果是:
Array
(
[0] => aaa
[1] => ddd
[2] => bbb
[3] => ccc
)
答案 1 :(得分:0)
$stmyarr=array ('0' => array('0'=>'a','1'=>'b','2'=>'c'));
$array = array_values($stmyarr[0]);
print_r($stmyarr);
答案 2 :(得分:0)
答案 3 :(得分:0)
$stmyarr=array ( '0' => array('0'=>'aaa','1'=>'ddd','2'=>'bbb','3'=>'ccc'));
$stmyarr=current(array_values($stmyarr));