我正在处理大型产品数据API。 我得到了大量的多维数组形式的产品数据。
在我的代码中,我有130个类别。 每一个类别下都有一定数量的产品。 我得到的产品列表如下(我复制了数组的某些部分):Array
(
[0] => Array
(
[0] => Array
(
[product_id] => 10295
[sku] => BDK Motor
[name] => Motor VW Golf V 5 1K 2,0 SDI Diesel BDK 75 PS 55 KW
)
[1] => Array
(
[product_id] => 10502
[sku] => BDK Motor-2
[name] => Motor VW Golf V 2,0 SDI BDK 55 KW 75 PS
)
[2] => Array
(
[product_id] => 15693
[sku] => CAY Motor
[name] => Motor VW Audi Polo Touran Roomster Golf Leon 1,6 TDI CAY CAYA DE15693
)
[3] => Array
(
[product_id] => 17662
[sku] => AGR Motor
[name] => Motor 1999 VW Audi Skoda Seat Golf A3 8L Octavia 1,9 TDI Diesel AGR
)
[4] => Array
(
[product_id] => 18980
[sku] => ZJ-VEM Motor
[name] => Motor Mazda 2 II DE 1,3 Benzin 55 KW 75 PS ZJ-VEM
)
[1] => Array
(
[0] => Array
(
[product_id] => 18245
[sku] => 08649262 Motorhalter-4
[name] => Motorhalter Ford Focus II DA 2,5 ST 166 KW 225 PS HYDA 08649262 SCHROTT
)
[1] => Array
(
[product_id] => 24041
[sku] => 8D0199335N Halter
[name] => Halter Anschlag Audi 80 A4 Seat Ibiza VW Caddy Passat Golf 1,9 TDI 1Z 8D0199335N
)
[2] => Array
(
[product_id] => 24472
[sku] => 9639593380 Halter-1
[name] => Halter Peugeot Citroen Berlingo C5 Xantia 206 307 2,0 HDI RHY DW10TD 9639593380
)
[3] => Array
(
[product_id] => 24606
[sku] => 2247711 Motorhalter-3
[name] => Motorhalter Halter Rover MG ZT ZT-T 75 RJ 2,0 CDTi 131 PS 204D2 2247711
)
[4] => Array
(
[product_id] => 24613
[sku] => 204D2 Halter-5
[name] => Halter Halterung Träger Rover MG ZT ZT-T 75 2,0 CDTi 131 PS 204D2
)
并且该阵列最多持续75个阵列密钥,每个密钥具有平均80-90个乘积。
我想要得到这样的输出:如果键[0]有100个项,而键[1]有90个项,那么在结果数组中,在第一个100个项之后,键[1]的下一个项追加为[101]; [102];。。。等等。
要清除我的问题,我需要如下输出:Array(
[0]=>
[1]=>
[2]=>
.
.
.
.
[109]=>
.
.
.
[nth key]=>)