X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP array_fill_keys() Function

PHP Array Reference PHP Array Reference

Example

Fill an array with values, specifying keys:

<?php
$keys=array("a","b","c","d");
$a1=array_fill_keys($keys,"blue");
print_r($a1);
?>

Run example »

Definition and Usage

The array_fill_keys() function fills an array with values, specifying keys.


Syntax

array_fill_keys(keys,value);

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

Technical Details

Return Value: Returns the filled array
PHP Version: 5.2+


PHP Array Reference PHP Array Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook