PHP function str_repeat()

Availability in PHP 4.0

Repeats string.

Parameters

Parameter Data type Default value Note
$input string not String to be repeated
$multiplier int not How many times to repeat

Return values

string

The final repeated string.

php
echo 'A' . str_repeat('a', 5) . 'hi'; // Aaaaaahoy

Other resources

[Official str-repeat documentation](Official str-repeat documentation)

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.