<?php
$data = [
[
'sku' => '049-1090',
'color' => 'color:Beige;Brown|',
'Finish' => 'Finish:Distressed;Handscraped;Matt|',
'Grade' => 'Grade:B (Select/Advantage)|',
'Installation Location' => 'Installation Location:Second Floor;Main Floor|',
'Installation Method' => 'Installation Method:Nail Down|',
'Specie' => 'Specie:Maple|',
'Warranty' => 'Warranty:25 Years|',
'Width' => 'Width:5 inch|'
],
[
'sku' => '107-1079',
'color' => 'color:Brown;Yellow|',
'Edge' => 'Edge:Square Edge|',
'Finish' => 'Finish:Matt|',
'Grade' => 'Grade:B (Select/Advantage)|',
'Installation Location' => 'Installation Location:Second Floor;Main Floor|',
'Installation Method' => 'Installation Method:Glue Down;Nail Down|',
'Specie' => 'Specie:Maple|',
'Warranty' => 'Warranty:25 Years|',
'Width' => 'Width:3 5/8 inch|'
]
];
$final_array = [];
foreach ($data as $row) {
$sku = $row['sku'];
unset($row['sku']);
$final_array[] = [
'sku' => $sku,
'feature' => rtrim(implode($row), '|')
];
}
var_export($final_array);
preferences:
55.2 ms | 402 KiB | 5 Q