Hàm array_fill () trong PHP
Thí dụ
Điền vào một mảng với các giá trị:
<?php
$a1=array_fill(3,4,"blue");
print_r($a1);
?>
Định nghĩa và Cách sử dụng
Hàm array_fill () điền vào một mảng với các giá trị.
Cú pháp
array_fill(index, number, value)
Giá trị tham số
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 |
Chi tiết kỹ thuật
Giá trị trả lại: | Trả về mảng đã lấp đầy |
---|---|
Phiên bản PHP: | 4,2+ |
❮ Tham chiếu mảng PHP