Easy Tutorial
❮ Func Array In Array Filter Validate Email ❯

PHP array_combine() Function

Complete PHP Array Reference Manual

Example

Create a new array by merging two arrays, where one array's elements are the keys and the other array's elements are the values:


Definition and Usage

The array_combine() function creates a new array by merging two arrays, where one array's elements are the keys and the other array's elements are the values.

Note: The number of elements in the key array and the value array must be the same!


Syntax

Parameter Description
keys Required. Specifies the array of keys.
values Required. Specifies the array of values.

Technical Details

Return Value: Returns the combined array. Returns FALSE if the number of elements in the two arrays is not the same.
PHP Version: 5+
--- ---
Update Log: Before PHP 5.4, an E_WARNING level error is thrown and FALSE is returned if the arrays are empty.
--- ---
❮ Func Array In Array Filter Validate Email ❯