← All built-ins / array_fill_keys()
array_fill_keys()
array_fill_keys(...$args): mixed
Parameters
| Name | Type | Description |
|---|---|---|
| $keys | array | list of keys |
| $value | mixed | value for every key |
Return value
Map with each key mapped to $value.
Example
$m = array_fill_keys(["x", "y", "z"], 0); echo $m["x"], $m["y"], $m["z"];
000