Php/docs/function.str-repeat

提供:Dev Guides
< Php
移動先:案内検索

str_repeat

(PHP 4, PHP 5, PHP 7)

str_repeat文字列を反復する


説明

str_repeat ( string $string , int $times ) : string

stringtimes 回を繰り返した文字列を返します。


パラメータ

string

繰り返す文字列。

times

string を繰り返す回数。

times は 0 以上でなければなりません。 times が 0 に設定された場合、この関数は空文字を返します。


返り値

繰り返した文字列を返します。


例1 str_repeat() の例

<?phpecho str_repeat("-=", 10);?>

上の例の出力は以下となります。


-=-=-=-=-=-=-=-=-=-=

参考