Home > php教程 > php手册 > body text

如何学习PHP array_fill()

WBOY
Release: 2016-06-13 09:29:44
Original
1172 people have browsed it

如何学习PHP array_fill()

 定义和用法

array_fill() 函数用给定的值填充数组,返回的数组有 number 个元素,值为 value。返回的数组使用数字索引,从 start 位置开始并递增。如果 number 为 0 或小于 0,就会出错。

语法

array_fill(start,number,value)

 

参数

描述

 

start必需。数值,规定键的起始索引。

number必需。数值,规定填充的数量,其值必须大于 0。

value必需。规定要插入的值。

 

 

例子

输出:

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

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template