68
PHP string str_repeat() Function
The str_repeat() is predefine function of PHP. It is used to repeat a string a specified number times. It returns input repeated multiple times.
Syntax:
Parameter | Description | Required/Optional |
---|---|---|
String | Specify the string to repeat. | Required |
repeat | Specify the number of times for repeated. | required |
Example 1
Output:
Before using 'str_repeat()' function: ('.',13) After using 'str_repeat()' function:..............
Example 2
Output:
Before using 'str_repeat()' function: ('-=',10) After using 'str_repeat()' function:-=-=-=-=-=-=-=-=-=-=
Example 3
Output:
Before using 'str_repeat()' function: (' ??,10) After using 'str_repeat()' function: ? ? ? ? ? ? ? ? ? ?;
Next TopicPHP String