str_repeat
(PHP 4, PHP 5, PHP 7)
str_repeat — 文字列を反復する
説明
str_repeat
( string $string
, int $times
) : string
string
を
times
回を繰り返した文字列を返します。
パラメータ
string
繰り返す文字列。
times
string
を繰り返す回数。times
は 0 以上でなければなりません。times
が 0 に設定された場合、この関数は空文字を返します。
返り値
繰り返した文字列を返します。
例
例1 str_repeat() の例
<?phpecho str_repeat("-=", 10);?>
上の例の出力は以下となります。
-=-=-=-=-=-=-=-=-=-=