Arrays can contain repeated values but, for obvious reasons, cannot contain repeated keys. array_combine
will overwrite the value corresponding to each duplicate key it finds.
Assuming that all your serial numbers are unique, a simple solution would be to swap round your array_combine
to make the serial number the key:
foreach (array_combine($serial, $make) as $number => $model):
If you have a one-to-many relationship between “make” and “serial number”, you might want to consider changing your data structure so that each make corresponds to an array of serial numbers.
solved PHP array_merge combining arrays with same values