PHP str_repeat Function

What is str_repeat Function?

Explanation

This function is used to repeat a string in PHP.

Syntax:


str_repeat(string,multiplier)

The syntax specifies the string to be repeated for number of times as given in multiplier

Example :


<?php
echo str_repeat("Hscripts",4);
?>
Result :

Hscripts Hscripts Hscripts Hscripts

In the above example the string "Hscripts" is repeated four times

PHP Topics


Ask Questions

Ask Question