Home > PHP > Function > Arrays > array_combine()

array_combine()

array_combine - Creates an array by using one array for keys and another for its values

Syntax

array array_combine (array $keys, array $values)

Arguments

  • keys - Array of keys to be used. Illegal values for key will be converted to string.
  • values - Array of values to be used

Description

Creates an array by using the values from the keys array as keys and the values from the values array as the corresponding values.

Version

PHP 5

Return value

Returns the combined array, FALSE if the number of elements for each array isn't equal or if the arrays are empty.