string str_repeat ($string, $no_of_times)Parameters : This function takes two parameters, both of which are required to pass.
Input: $str = ’GeeksForGeeks’; print_r (str_repeat ($str, 2)); Output: GeeksForGeeksGeeksForGeeks Input: $str = ’Run’; print_r (str_repeat ($str, 7)); Output: Run Run Run Run Run Run RunThe following programs illustrate the str_repeat() function in PHP:
Program - 1 :
< tbody> php
// Input line
$str
=
’GeeksForGeeks’
;
// Duplicate line
print_r (
str_repeat
(
$str
, 2));
?>
Output:GeeksForGeeksGeeksForGeeksProgram - 2 :
< tbody> php
// Input line
$str
=
’Run’
;
// Duplicate line
print_r (
str_repeat
(
$str
, 7));
?>
Exit:Run Run Run Run Run Run RunLink :
http: //php.net/manual/en/function.str-repeat.php