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.

Example

Repeat the string "Shanghai" 5 times:

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token keyword">echo</span> <span class="token function">str_repeat</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"Shanghai"</span> <span class="token punctuation">,</span> <span class="token number">5</span> <span class="token punctuation">)</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

Try it yourself

Similar Functions
  • Calculate the md5 hash value of a given file md5_file

    md5_file

    Calculatethemd5hashv
  • Convert the first byte of the string to a value between 0-255 ord

    ord

    Convertthefirstbyteo
  • Return part of the string substr

    substr

    Returnpartofthestrin
  • Find any one of a set of characters in a string - Return a substring that starts with the found character strpbrk

    strpbrk

    Findanyoneofasetofch
  • Case-insensitive strstr stristr

    stristr

    Case-insensitivestrs
  • Insert HTML newline tag before all new lines of a string nl2br

    nl2br

    InsertHTMLnewlinetag
  • Calculate the edit distance between two strings levenshtein

    levenshtein

    Calculatetheeditdist
  • Calculate the similarity between two strings similar_text

    similar_text

    Calculatethesimilari
Popular Articles