php 如何将三维组转换为二维数组
<?php$a=Array([0]=>Array([seller_credit]=>Array([total_num]=>373405[level]=>15[good_n...
<?php
$a=Array
(
[0] => Array
(
[seller_credit] => Array
(
[total_num] => 373405
[level] => 15
[good_num] => 368452
[score] => 367826
)
)
[1] => Array
(
[seller_credit] => Array
(
[total_num] => 36409
[level] => 12
[good_num] => 36091
[score] => 36042
)
)
);
?> 展开
$a=Array
(
[0] => Array
(
[seller_credit] => Array
(
[total_num] => 373405
[level] => 15
[good_num] => 368452
[score] => 367826
)
)
[1] => Array
(
[seller_credit] => Array
(
[total_num] => 36409
[level] => 12
[good_num] => 36091
[score] => 36042
)
)
);
?> 展开
1个回答
展开全部
使用foreach或for循环来重新构造一个二维数组。取三维数组中需要的元素。
具体语句取决于数组结构。建议贴出三维数组的结构。
===================
你想转成什么样的? 只需要
[seller_credit] => Array
(
[total_num] => 36409
[level] => 12
[good_num] => 36091
[score] => 36042
)
)
这部分内容吗?
$new_a = array();
foreach($a as $aitem){
$new_a[] = $aitem['seller_credit'];
}
具体语句取决于数组结构。建议贴出三维数组的结构。
===================
你想转成什么样的? 只需要
[seller_credit] => Array
(
[total_num] => 36409
[level] => 12
[good_num] => 36091
[score] => 36042
)
)
这部分内容吗?
$new_a = array();
foreach($a as $aitem){
$new_a[] = $aitem['seller_credit'];
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询