PHP array_fill_keys() Function

PHP array_fill_keys Function


Description :

The array_fill_keys() function fills an array with a value and lets you specify what key to use.

The following table summarizes the technical details of this function.

Syntax :

The basic syntax of the array_fill_keys() function is given with:

        array_fill_keys(keysvalue);

Parameters :

The array_fill_keys() function accepts the following parameters.

Parameter Description
keys Required. Specifies the array of values that will be used as keys. Illegal values for the key will be converted to string.
value Required. Specifies the value to use for filling the array.

 

Output :

Array
(
    [web] => hello
    [designing] => hello
    [house] => hello
)