The array_fill() function is used to fill an array with values. It returns the filled array. It returns the filled array.
Syntax
array_fill(start_index, num, value)
Parameters
start_index − First index of the returned array. Required.
num − The count of elements to insert. Required.
value − The value that would fill the array. Required.
Return
The array_fill() function returns the filled array.
Example
<?php $a = array_fill(3, 5, 'demo'); print_r($a); ?>
Output
Array ( [3] => demo [4] => demo [5] => demo [6] => demo [7] => demo )