PHP str_repeat() function in PHP || PHP str_repeat() function
×


str_repeat() function in php

1969

PHP str_repeat() function is used to repeat a string to a particular number of times given by the user. It is an inbuilt function of PHP.

Syntax:

str_repeat($string, $repeat);

here,

  • $string is a PHP string.
  • $repeat represents the number of repentance of the string.

Example:

<?php
$str="hello ";
$modify_str=str_repeat($str,5);
echo "Original string is : <strong>$str</strong><br>";
echo "Repeated string is : <strong>$modify_str</strong>";
?>

Output:




Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments