当前位置: 首页> 函数类别大全> 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>

亲自试一试

同类函数
  • 替换字符串的子串 substr_replace

    substr_replace

    替换字符串的子串
  • 以千位分隔符方式格式化一个数字 number_format

    number_format

    以千位分隔符方式格式化一个数字
  • 删除字符串末端的空白字符(或者其他字符) rtrim

    rtrim

    删除字符串末端的空白字符(或者其他字符)
  • 查找指定字符在字符串中的最后一次出现 strrchr

    strrchr

    查找指定字符在字符串中的最后一次出现
  • 反转义一个转义的字符串 stripslashes

    stripslashes

    反转义一个转义的字符串
  • 将字符串转化为小写 strtolower

    strtolower

    将字符串转化为小写
  • 计算字符串中全部字符都存在于指定字符集合中的第一段子串的长度 strspn

    strspn

    计算字符串中全部字符都存在于指定字符集合
  • 返回字符串的一部分 substr

    substr

    返回字符串的一部分
热门文章