Returns input repeated multiplier times. Test str_repeat online.

string str_repeat ( string $input , int $multiplier )

Maximum string length 1000 characters.
Multiplier has to be greater than or equal to 0. Maximum value 999.

PHP Documentation by the PHP Documentation Group


(PHP 4, PHP 5, PHP 7)

str_repeatRepeat a string


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

Returns input repeated multiplier times.



The string to be repeated.


Number of time the input string should be repeated.

multiplier has to be greater than or equal to 0. If the multiplier is set to 0, the function will return an empty string.

Return Values

Returns the repeated string.


Example #1 str_repeat() example

echo str_repeat("-="10);

The above example will output:


See Also

PHP Documentation

Copyright © 1997 - 2016 by the PHP Documentation Group. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution 3.0 License or later. A copy of the Creative Commons Attribution 3.0 license is distributed with this manual. The latest version is presently available at » http://creativecommons.org/licenses/by/3.0/.