Fill an array with values:
<?php
$a1=array_fill(3,4,"blue");
print_r($a1);
?>
Try it Yourself »
The array_fill() function fills an array with values.
array_fill(
index, number, value)
Parameter | Description |
---|---|
index | Required. The first index of the returned array |
number | Required. Specifies the number of elements to insert |
value | Required. Specifies the value to use for filling the array |
Return Value: | Returns the filled array |
---|---|
PHP Version: | 4.2+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!