英 [r??pi:t]? ?美 [r??pit]??

vt.重復(fù);復(fù)述,背誦

vi.重做;重復(fù)投票

n.重復(fù);(節(jié)目)重演;重復(fù)的事物

第三人稱(chēng)單數(shù): repeats 復(fù)數(shù): repeats 現(xiàn)在分詞: repeating 過(guò)去式: repeated 過(guò)去分詞: repeated

php str_repeat()函數(shù) 語(yǔ)法

str_repeat()函數(shù)怎么用?

php str_repeat()函數(shù)用于重復(fù)使用指定字符串,語(yǔ)法是str_repeat(string,repeat),此函數(shù)把字符串重復(fù)指定的次數(shù)。

作用:重復(fù)使用指定字符串

語(yǔ)法:str_repeat(string,repeat)

參數(shù):

參數(shù)描述
string必須,要重復(fù)的字符串
repeat必須,規(guī)定字符串重復(fù)的次數(shù),必須大于等于0

說(shuō)明:str_repeat()函數(shù)把字符串重復(fù)指定的次數(shù)

php str_repeat()函數(shù) 示例

<?php
$i = "hello world!";
$j = str_repeat($i,3);//設(shè)置字符串重復(fù)的次數(shù)為3
echo $j;
?>

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

輸出:

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

運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例

輸出:

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