Hàm mảng_fill() trong PHP
Ví 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);
?>
Hãy tự mình thử »Định nghĩa và cách sử dụng
Hàm array_fill() sẽ điền các giá trị vào một mảng.
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ả về: | Trả về mảng đã điền |
---|---|
Phiên bản PHP: | 4.2+ |
❮ Tham chiếu mảng PHP