Definition and usage
The array_fill() function fills the array with the given value. The returned array has number elements and the value is value. The returned array is numerically indexed, starting at the start position and increasing. If number is 0 or less than 0, an error occurs.
Grammar
array_fill(start,number,value)
Parameters
Description
start is required. A numeric value specifying the starting index of the key.
number is required. Numeric value specifies the amount of padding, and its value must be greater than 0.
value is required. Specifies the value to be inserted.
Example
Output:
Array ( [2] => Dog [3] => Dog [4] => Dog )