I'm wondering if it's possible to clean this code up a bit...I have an array of car categories and each key is a vehicle code. There are several vehicle codes that I am mapping to a particular category (ex. Small, Medium, Large). I've asked a similar question previously, but I'm not sure if it was clear so I simplified my question. I'd like to keep this similar format, but wondering if it's possible to do something like this (so that I don't have to write "Small" more than once):
$categories = [
'L...' => 'Luxury',
'W...' => 'Luxury',
'X...' => 'Specialty',
'CB..', 'CC..', 'CD..' => 'Small'
// Is something like this possible to do within the $categories array ?
];
Current Code:
$categories = [
'L...' => 'Luxury',
'W...' => 'Luxury',
'X...' => 'Specialty',
'CB..' => 'Small',
'CC..' => 'Small',
'CD..' => 'Small',
'DB..' => 'Small',
'DC..' => 'Small',
'DD..' => 'Small',
'EB..' => 'Small',
'EC..' => 'Small',
'ED..' => 'Small',
'HB..' => 'Small',
'HC..' => 'Small',
'HD..' => 'Small',
'MB..' => 'Small',
'MC..' => 'Small',
'MD..' => 'Small',
'NB..' => 'Small',
'NC..' => 'Small',
'ND..' => 'Small',
'IB..' => 'Medium',
'IC..' => 'Medium',
'ID..' => 'Medium',
'JB..' => 'Medium',
'JC..' => 'Medium',
'JD..' => 'Medium',
'RB..' => 'Medium',
'RC..' => 'Medium',
'RD..' => 'Medium',
'SB..' => 'Medium',
'SC..' => 'Medium',
'SD..' => 'Medium',
'FB..' => 'Large',
'FC..' => 'Large',
'FD..' => 'Large',
'GB..' => 'Large',
'GC..' => 'Large',
'GD..' => 'Large',
'PB..' => 'Large',
'PC..' => 'Large',
'PD..' => 'Large',
'UB..' => 'Large',
'UC..' => 'Large',
'UD..' => 'Large',
'.E..' => 'Sports', // Coupe
'.F..' => 'SUV',
'.G..' => 'SUV', // Crossover
'.H..' => 'RV', // Motor Home
'.J..' => 'Off-Road Vehicle',
'.K..' => 'Commercial',
'.L..' => 'Luxury', // Limousine
'.M..' => 'Van', // Monospace
'.N..' => 'Convertible', // Roadster
'.P..' => 'Pickup Truck',
'.Q..' => 'Pickup Truck',
'.R..' => 'RV',
'.S..' => 'Sports',
'.T..' => 'Convertible',
'.V..' => 'Van',
'.W..' => 'Wagon',
'.X..' => 'Specialty',
'.Z..' => 'Specialty',
'...C' => 'Electric',
'...E' => 'Electric',
'...H' => 'Hybrid',
'...I' => 'Hybrid'
];