The function array_fill_keys() that fills the array with the key value of the specified key name given by php

黄舟
Release: 2023-03-17 07:38:02
Original
1715 people have browsed it

Example

Fill thearraywith the key value of the given specified key name:

Copy after login

Definition and usage

array_fill_keys()FunctionFills the array with the key value of the given specified key name.

Syntax

array_fill_keys(keys,value);
Copy after login
Parameters Description
keys Required. Array whose values will be used to populate the array keys.
value Required. Specifies the key values used to populate the array.

Technical Details

Return value: Returns the populated array.
PHP version: 5.2+

Example:

Copy after login

The running results are as follows :

Array( [foo] => banana [5] => banana [10] => banana [bar] => banana )
Copy after login


The above is the detailed content of The function array_fill_keys() that fills the array with the key value of the specified key name given by php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!