英 [rɪˈpi:t]   美 [rɪˈpit]  

vt.重复;复述,背诵

vi.重做;重复投票

n.重复;(节目)重演;重复的事物

第三人称单数: repeats 复数: repeats 现在分词: repeating 过去式: repeated 过去分词: repeated

php str_repeat()函数 语法

str_repeat()函数怎么用?

php str_repeat()函数用于重复使用指定字符串,语法是str_repeat(string,repeat),此函数把字符串重复指定的次数。

作用:重复使用指定字符串

语法:str_repeat(string,repeat)

参数:

参数描述
string必须,要重复的字符串
repeat必须,规定字符串重复的次数,必须大于等于0

说明:str_repeat()函数把字符串重复指定的次数

php str_repeat()函数 示例

<?php
$i = "hello world!";
$j = str_repeat($i,3);//设置字符串重复的次数为3
echo $j;
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

输出:

hello world!hello world!hello world!
<?php
$i = "Learn PHP to come to php.cn<br>";
$j = str_repeat($i,3);
print_r($j);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

输出:

Learn PHP to come to php.cn
Learn PHP to come to php.cn
Learn PHP to come to php.cn

热门推荐