Current Location: Home> Function Categories> str_repeat

str_repeat

Repeat a string
Name:str_repeat
Category:String
Programming Language:php
One-line Description:Repeat the string as specified number of times.

Definition and usage

str_repeat() function repeats the string as specified.

Example

Repeat the string "Shanghai" 5 times:

 <?php
echo str_repeat ( "Shanghai" , 5 ) ;
?>

Try it yourself

grammar

 str_repeat ( string , repeat )
parameter describe
string Required. Specifies the string to be repeated.
repeat Required. Specifies the number of times the string will be repeated. Must be greater than or equal to 0.
Similar Functions
  • Comparison of strings based on locale settings strcoll

    strcoll

    Comparisonofstringsb
  • Parsing CSV strings into arrays str_getcsv

    str_getcsv

    ParsingCSVstringsint
  • Alias ​​of strstr strchr

    strchr

    Alias​​ofstrstr
  • Convert the first byte of the string to a value between 0-255 ord

    ord

    Convertthefirstbyteo
  • Perform a rot13 conversion on a string str_rot13

    str_rot13

    Performarot13convers
  • Convert the value of a one-dimensional array into a string implode

    implode

    Convertthevalueofaon
  • Calculate the last occurrence of the specified string in the target string strrpos

    strrpos

    Calculatethelastoccu
  • Output formatted string printf

    printf

    Outputformattedstrin
Popular Articles