當前位置: 首頁> 函數類別大全> str_repeat

str_repeat

重複一個字符串
名稱:str_repeat
分類:字符串
所屬語言:php
一句話介紹:把字符串重複指定的次數。

實例

把字符串"Shanghai " 重複5 次:

 <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>

親自試一試

同類函數
  • 在字符串所有新行之前插入HTML 換行標記 nl2br

    nl2br

    在字符串所有新行之前插入HTML換行標記
  • 從數字生成單字節字符串 chr

    chr

    從數字生成單字節字符串
  • 將字符串的第一個字符設為小寫 lcfirst

    lcfirst

    將字符串的第一個字符設為小寫
  • 使用反斜線轉義字符串 addslashes

    addslashes

    使用反斜線轉義字符串
  • 在字符串中查找一組字符的任何一個字符-返回一個以找到的字符開始的子字符串 strpbrk

    strpbrk

    在字符串中查找一組字符的任何一個字符-返
  • 返回有關字符串中使用的單詞的信息 str_word_count

    str_word_count

    返回有關字符串中使用的單詞的信息
  • 子字符串替換 str_replace

    str_replace

    子字符串替換
  • 查找字符串的首次出現 strstr

    strstr

    查找字符串的首次出現
熱門文章