PHP - 字串重複函式



語法

str_repeat(string,length,pad_string,pad_type)

定義和用法

用於將字串重複特定次數。

返回值

返回重複後的字串

引數

序號 引數及描述
1

字串

指定要重複的字串

2

重複次數

指定要重複字串的次數

示例

嘗試以下示例

<?php
   echo str_repeat("tutorialspoint",5);
?>

這將產生以下結果:

tutorialspointtutorialspointtutorialspointtutorialspointtutorialspoint
php_function_reference.htm
廣告