How can you merge two arrays in PHP and create a new array with one as keys and the other as values?

To merge two arrays in PHP and create a new array with one as keys and the other as values, you can use the array_combine() function. This function takes two arrays as parameters, where the first array provides keys and the second array provides values. It then returns a new array where the elements of the first array are used as keys and the elements of the second array are used as values.

$array1 = array('a', 'b', 'c');
$array2 = array(1, 2, 3);

$mergedArray = array_combine($array1, $array2);

print_r($mergedArray);