NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - array_fill

Trieda

Koreň \ Bez triedy

Metóda - array_fill

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

The function creates a new array filled with the entered values.

Procedurálne

  • function array_fill (int $start_index, int $num, mixed $value) : array

Parametre

NázovDátový typPredvolená hodnotaPopis
$start_indexint

The start index.

$numint

The number of elements.

$valuemixed

A value to insert.

Mávratovej hodnoty

Vracia: array

The filled array.

Príklady

<?php
$array = array_fill(0, 5, 'value');

print_r($array);

Súvisiace manuály

      • function str_repeat (string $input, int $multiplier) : string
      Aktivity