How to repeat a string to a specific number of times in PHP?
The str_repeat() function is used to repeat a string, a specified number of times.
<?php
$string=”PHP”;
echo str_repeat($string, 3);
?>
OUTPUT
PHPPHPPHP
<?php
$string=”PHP”;
echo str_repeat($string, 2);
?>
OUTPUT
PHP
The post How to repeat a string to a specific number of times in PHP? appeared first on PHPGurukul.