← All built-ins / array_combine()
array_combine()
array_combine(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $keys | array | list of keys |
| $values | array | list of values (same length) |
Return value
Map built from the two lists.
Example
$m = array_combine(["a", "b"], [1, 2]); echo $m["a"], $m["b"];
12