文字列を反復する

サンプルソース

<?php
// 文字列を反復する
$s = str_repeat("1", 5);

// 結果は 11111
?>

解説

str_repeatで文字列を指定回数だけ反復します。


関連する内容



スポンサードリンク



 

Copyright (C) PHP@Workshop All rights reserved.