In PHP, the str_repeat() function, which is inbuilt is used to repeat a string for a specific number of times. This str_repeat() function creates new strings by repeating the given string ‘n’ number of times as specified.

Here is the syntax of the str_repeat() function: str_repeat(string, repeat)

Example

                                        

Here is an example demonstrating the same:
echo str_repeat("BIQ ", 2);

Output

BIQ BIQ

Suggest An Answer

Our Particitants