Home »

What Is difference between array_combine and array_merge?

Question ListCategory: PHPWhat Is difference between array_combine and array_merge?
ethanbrown author asked 10 years ago
1 Answers
jamessmith05 author answered 8 years ago

array_combine give an array by combining two arrays($keyArray, $valueArray) and both $keyArray & $valueArray must have same number of elements. $keyArrays become keys of returning Array, $valueArray become values of returning Arrays.

array_merge gives an array by merging two array ($array1, $array2) and both can have different number of elements. $array1 and $array2 are added in returning array.

Please login or Register to Submit Answer