PHP Processing Multiple Arrays Together Combining two arrays (keys from one, values from another)


The following example shows how to merge two arrays into one associative array, where the key values will be the items of the first array, and the values will be from the second:

$array_one = ['key1', 'key2', 'key3'];
$array_two = ['value1', 'value2', 'value3'];

$array_three = array_combine($array_one, $array_two);

    array (
      'key1' => 'value1',
      'key2' => 'value2',
      'key3' => 'value3',