Funkcja array_fill() PHP
Przykład
Wypełnij tablicę wartościami:
<?php
$a1=array_fill(3,4,"blue");
print_r($a1);
?>
Definicja i użycie
Funkcja array_fill() wypełnia tablicę wartościami.
Składnia
array_fill(index, number, value)
Wartości parametrów
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 |
Szczegóły techniczne
Wartość zwrotu: | Zwraca wypełnioną tablicę |
---|---|
Wersja PHP: | 4.2+ |
❮ Odniesienie do tablicy PHP