Home > Backend Development > PHP Tutorial > How to learn PHP array_fill()_PHP tutorial

How to learn PHP array_fill()_PHP tutorial

WBOY
Release: 2016-07-13 10:23:40
Original
1208 people have browsed it

How to learn PHP array_fill()

Definition and usage

The array_fill() function fills the array with the given value. The returned array has number elements and the value is value. The returned array is numerically indexed, starting at the start position and increasing. If number is 0 or less than 0, an error occurs.

Grammar

array_fill(start,number,value)

Parameters

Description

start is required. A numeric value specifying the starting index of the key.

number is required. Numeric value specifies the amount of padding, and its value must be greater than 0.

value is required. Specifies the value to be inserted.

Example

Output:

Array ( [2] => Dog [3] => Dog [4] => Dog )

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/834959.htmlTechArticleHow to learn PHP array_fill() definition and usage array_fill() function fills an array with a given value and returns the array There are number elements with value value. The returned array is numerically indexed, ...
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template