PHP array_fill()ฟังก์ชั่น
ตัวอย่าง
เติมอาร์เรย์ด้วยค่า:
<?php
$a1=array_fill(3,4,"blue");
print_r($a1);
?>
ความหมายและการใช้งาน
ฟังก์ชัน array_fill() เติมอาร์เรย์ด้วยค่าต่างๆ
ไวยากรณ์
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 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับอาร์เรย์ที่เติม |
---|---|
รุ่น PHP: | 4.2+ |
❮ การอ้างอิงอาร์เรย์ PHP