Existing data is as follows: large bag cup DPK219VAC0011.00 small bag large cup DPK219VBW0011.00 pot of crab meat 1 pound tank RCN061-1VAC0012.00 pot of crab meat 1 pound pot of RCN061-1VBW0012.00 meat 5 mmrfb300-2vb... the existing data is as follows:
Renew bag mug DPK219 VAC001 1.00
Renew bag mug DPK219 VBW001 1.00
Pot of crab meat 1 lb/tank RCN061-1 VAC001 2.00
1 pound/pot RCN061-1 VBW001 2.00
Strip 5mm RFB300-2 VAC001 3.00
Premium strip 5mm RFB300-2 VBW001 3.00
RFB300-3 VAC001 4.00
RFB300-3 VBW001 4.00
The requirement is to output a table (similar to excel). All the information of the same product is output in one row. There are four rows in total, as shown below:
Extra bag mug 1.00 1.00
1 lb/2.00 2.00
Niu Lin film 5mm 3.00 3.00
Thick Niu Lin film 4.00 4.00
Don't blame cainiao.
Reply content:
The existing data is as follows:
Renew bag mug DPK219 VAC001 1.00
Renew bag mug DPK219 VBW001 1.00
Pot of crab meat 1 lb/tank RCN061-1 VAC001 2.00
1 pound/pot RCN061-1 VBW001 2.00
Strip 5mm RFB300-2 VAC001 3.00
Premium strip 5mm RFB300-2 VBW001 3.00
RFB300-3 VAC001 4.00
RFB300-3 VBW001 4.00
The requirement is to output a table (similar to excel). All the information of the same product is output in one row. There are four rows in total, as shown below:
Extra bag mug 1.00 1.00
1 lb/2.00 2.00
Niu Lin film 5mm 3.00 3.00
Thick Niu Lin film 4.00 4.00
Don't blame cainiao.
In order to give you an example, it will be mixed up.
'Fill bag cup ', 'typea' => 'dpk219', 'typeb' => 'vac001', 'price' => '1. 00'), array ('catoggary '=> 'character bag mug', 'typea' => 'dpk219 ', 'typeb' => 'vbw001 ', 'price' => '1. 00'), array ('catoggary '=> 'canned crab meat', 'typea' => 'rcn061-1', 'typeb' => 'vac001 ', 'price' => '2. 00'), array ('catoggary '=> 'canned crab meat', 'typea' => 'rcn061-1', 'typeb' => 'vbw001 ', 'price' => '2. 00'), array ('catoggary '=> 'nougat 100', 'typea' => 'rfb300-2',' t Ypeb' => 'vac001', 'price' => '3. 00'), array ('catoggary '=> 'nougat 100', 'typea' => 'rfb300-2', 'typeb' => 'vbw001 ', 'price' => '3. 00'), array ('catoggary '=> 'thick Niu line', 'typea' => 'rfb300-3', 'typeb' => 'vac001 ', 'price' => '4. 00'), array ('catoggary '=> 'thick Niu line', 'typea' => 'rfb300-3', 'typeb' => 'vbw001 ', 'price' => '4. 00'),); $ tableInfo = array (); // $ tableInfo = array_column ($ info, 'catoggary ', 'price ');/ /If php version> 5.5 foreach ($ info as $ item) $ tableInfo [$ item ['catogary'] = $ item ['price'];?>In general, we will first put the data in an array.info
And then filter the array to retrieve the useful data that needs to be displayed in the table to a new array.tableInfo
. Next, traverse the new array and output the data to the table.table
. As follows: