我对这段代码有一个大麻烦,我需要格式化一个数组以在不同的选择中使用,我有一个与此相同的数组结构:array (size=6) 0 => array (size=9) 0 => string 'Dorado' (length=6) 1 => string '32GB' (length=4) 2 => string 'Plastico' (length=8) 'vlr' => string '40000' (length=5) 'pcost' => string '0' (length=1) 'pcomp' => string '0' (length=1) 'sede' => array (size=1) 9 => string '0' (length=1) 'ptc' => array (size=2) 12 => string '0' (length=1) 11 => string '0' (length=1) 's' => string '' (length=0) 1 => array (size=9) 0 => string 'Dorado' (length=6) 1 => string '32GB' (length=4) 2 => string 'Madera' (length=6) 'vlr' => string '40000' (length=5) 'pcost' => string '0' (length=1) 'pcomp' => string '0' (length=1) 'sede' => array (size=1) 9 => string '0' (length=1) 'ptc' => array (size=2) 12 => string '0' (length=1) 11 => string '0' (length=1) 's' => string '' (length=0) 2 => array (size=9) 0 => string 'Dorado' (length=6) 1 => string '64GB' (length=4) 2 => string 'Plastico' (length=8) 'vlr' => string '60000' (length=5) 'pcost' => string '0' (length=1) 'pcomp' => string '0' (length=1) 'sede' => array (size=1) 9 => string '0' (length=1) 'ptc' => array (size=2) 12 => string '0' (length=1) 11 => string '0' (length=1) 's' => string '' (length=0) 3 => array (size=9) 0 => string 'Blanco' (length=6) 1 => string '32GB' (length=4) 2 => string 'Plastico' (length=8) 'vlr' => string '40000' (length=5) 'pcost' => string '0' (length=1) 'pcomp' => string '0' (length=1) 'sede' => array (size=1) 9 => string '0' (length=1) 'ptc' => array (size=2) 12 => string '0' (length=1) 11 => string '0' (length=1) 's' => string '' (length=0) 4 =>
1 回答
www说
TA贡献1775条经验 获得超8个赞
我得到了类似代码的答案,如果我想计算我的多维数组,我必须将 [] 空。
改变
$arrSelects[$item[0]][$item[$i]] = $item[$i];
为了:
$arrSelects[$item[0]][$i][] = $item[$i];
- 1 回答
- 0 关注
- 99 浏览
添加回答
举报
0/150
提交
取消