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

vt. Repeat; retell, recite

vi. Redo; repeat voting

n. Repeat; ( program) reenactment; repeated things

Third person singular: repeats Plural: repeats Present participle: repeating Past tense: repeated Past participle: repeated

php str_repeat() function syntax

How to use the str_repeat() function?

php The str_repeat() function is used to reuse the specified string. The syntax is str_repeat(string,repeat). This function repeats the string a specified number of times.

Function: Reuse the specified string

Syntax: str_repeat(string,repeat)

Parameters:

ParameterDescription
stringMust be repeated String
repeat is required. It specifies the number of repetitions of the string and must be greater than or equal to 0

##Description: str_repeat() function repeats the string a specified number of times

php str_repeat() function example

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

Run instance?

Click the "Run instance" button to view the online instance

Output:

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

Run Instance?

Click the "Run Instance" button to view the online instance

Output:

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