Consider these three arrays:
$Trucks: Serial=> 12345 Wheels => 4 Color => Black
$Trailers: Serial=>4321 Length=>42
$Forklifts: Serial=>5678 ForkLength=>24
What I'm looking to do is end up with a single array, which would end up with the columns Serial, Wheels, Color, Length, ForkLength
And the contents should end up looking like this
Serial,Wheels,Color,Length,ForkLength
12345,4,Black,NULL,NULL
4321,NULL,NULL,42,NULL
5678,NULL,NULL,NULL,24
Is this possible? I have tried the following code, but I end up with weird results, like some of the columns duplicating for trailers and forklifts.
$columns = Array("TraderCategory", "Make", "Model", "Year", "Last_Update", "VIN", "Trim", "Price", "Ext_Color", "Int_Color", "Engine", "HP", "Wheelbase", "Suspension", "KM", "Transmission", "Description", "NewUsed", "Torque", "Rear_Axle", "Front_Axle", "Differential", "Brakes", "StockNum", "ditl_Inventory", "new_truckStatus", "statuscode", "ditl_ShowonTrader", "new_truckId", "MainPic", "MainPicModified", "ExtraPics", "ExtraPicsModified", "Width", "Length");
foreach ($columns as $key => column) {
$finalArray[$column] = $truckinfoData[$key];
}
foreach ($columns as $key => column) {
$finalArray[$column] = $trailerinfoData[$key];
}
foreach ($columns as $key => column) {
$finalArray[$column] = $forkliftinfoData[$key];
}
return $finalArray;