Php/docs/function.str-repeat

提供:Dev Guides
< Php
2020年12月14日 (月) 12:35時点におけるNotes (トーク | 投稿記録)による版 (autoload)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先:案内検索

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);?>

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


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

参考