Função PHP array_fill()
Exemplo
Preencha uma matriz com valores:
<?php
$a1=array_fill(3,4,"blue");
print_r($a1);
?>
Definição e uso
A função array_fill() preenche um array com valores.
Sintaxe
array_fill(index, number, value)
Valores de parâmetro
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 |
Detalhes técnicos
Valor de retorno: | Retorna o array preenchido |
---|---|
Versão do PHP: | 4.2+ |
❮ Referência de array PHP