Home  >  Article  >  Backend Development  >  如何学习PHP array_fill()_PHP教程

如何学习PHP array_fill()_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:23:401094browse

如何学习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 )

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/834959.htmlTechArticle如何学习PHP array_fill() 定义和用法 array_fill() 函数用给定的值填充数组,返回的数组有 number 个元素,值为 value。返回的数组使用数字索引,...
Statement:
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