3v4l.org

run code in 200+ PHP versions simultaneously
<?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);
Output for 7.2.0 - 7.4.4
array ( 0 => array ( 'sku' => '049-1090', 'feature' => 'color:Beige;Brown|Finish:Distressed;Handscraped;Matt|Grade:B (Select/Advantage)|Installation Location:Second Floor;Main Floor|Installation Method:Nail Down|Specie:Maple|Warranty:25 Years|Width:5 inch', ), 1 => array ( 'sku' => '107-1079', 'feature' => 'color:Brown;Yellow|Edge:Square Edge|Finish:Matt|Grade:B (Select/Advantage)|Installation Location:Second Floor;Main Floor|Installation Method:Glue Down;Nail Down|Specie:Maple|Warranty:25 Years|Width:3 5/8 inch', ), )