Array key value encapsulation!
Baby颜值男神'W
Baby颜值男神'W 2021-08-28 15:55:30
0
2
856

$data = array( ['subject'=>'Low Section Chinese','one_name'=>'Writing Volume','two_name'=>'Old Poetry No. 1','title'= >'11111'], ['subject'=>'Low Section Chinese','one_name'=>'Writing Volume','two_name'=>'Old Poetry No. 1','title'=> ;'22222'], ['subject'=>'Low section Chinese','one_name'=>'Test paper','two_name'=>'Old Poetry No. 2','title'=> '666666'], ['subject'=>'Low Section Mathematics','one_name'=>'Exercise Paper','two_name'=>'Low Section Mathematics 1','title'=>'333333 '], ['subject'=>'Low Section Mathematics','one_name'=>'Exercise Paper','two_name'=>'Low Section Mathematics 2','title'=>'444444'] , ['subject'=>'Low Section Mathematics','one_name'=>'Evaluation Paper','two_name'=>'Low Section Mathematics 1','title'=>'777777'], [ 'subject'=>'High-level Chinese','one_name'=>'Painting Volume','two_name'=>'Painting 1','title'=>'555555'], );

I want to encapsulate it by subject first, then one_name at the bottom and two_name to make it encapsulated layer by layer.

Baby颜值男神'W
Baby颜值男神'W

reply all(2)
致自己

$newArr = [];foreach ($data as $v){ foreach ($v as $kk=>$vv){ $newArr[$kk][]=$vv; }}

This kind?

Peter_Zhu

I’ll sort out the code and send it again. There’s no format and it seems too laborious

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template