Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP array_fill() Function

PHP array_fill() Function

PHP Array ReferenceComplete PHP Array Reference Manual

Example

Fill an array with a given value:

Run Example »


Definition and Usage

The array_fill() function fills an array with a given value.


Syntax

array_fill(

index,number,value

);

Parameters Description
index Required. Specifies the starting index of the returned array.
number Required. Specifies the number of elements to fill; the value must be greater than 0.
value Required. Specifies the value used to fill the array.

Technical Details

Return Value: Returns the filled array.
PHP Version: 4.2+

PHP Array ReferenceComplete PHP Array Reference Manual