search
Homephp教程php手册php-Arrays函数-array_fill-用给定的值填充数组

array_fill() 函数 用给定的值填充数组

【功能】
         该函数将返回一个新的数组,
         该数组用被指定的数量的指定内容填充。
【使用范围】
         php4 > 4.2.0、php5.
【使用】
         array array_fill( int start_index, int num, mixed value )
         start_index/必需/新数组中键名的开始数
         num/必需/为新数组填充的个数,该值必须是一个大于零的值,否则php会发出一条警告
         value/必需/为新数组中的值
【示例】
[php]
print_r( array_fill( 5, 6, "hehe" ) ); 
/*
Array
(
    [5] => hehe
    [6] => hehe
    [7] => hehe
    [8] => hehe
    [9] => hehe
    [10] => hehe
)
*/ 

 


摘自 zuodefeng的笔记

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)