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 - str_repeat

Trieda

Koreň \ Bez triedy

Metóda - str_repeat

(PHP 4, PHP 5, PHP 7)

The str_repeat() function returns a given string repeated multiple times.

Procedurálne

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

Parametre

NázovDátový typPredvolená hodnotaPopis
$inputstring

A string for repeating.

$multiplierint

The number specifying how many times to repeat the given string. It must be greater than or equal to 0, otherwise the function will emit a warning. If the number is equal to 0, the function returns an empty string.

Mávratovej hodnoty

Vracia: string

Returns a string repeated multiple times.

Príklady

<?php
echo str_repeat("Hello world!<br />", 5);
echo str_repeat("This string will be never repeated", 0);

Súvisiace manuály

      • function str_pad (int $pad_length, string $pad_string = ) : string
      Aktivity