php str_repeat()函数 语法

php str_repeat()函数 语法

str_repeat()函数怎么用?

php str_repeat()函数用于重复使用指定字符串,语法是str_repeat(string,repeat),此函数把字符串重复指定的次数。大理石平台

作用:重复使用指定字符串

语法:str_repeat(string,repeat)

参数:

参数 描述
string 必须,要重复的字符串
repeat 必须,规定字符串重复的次数,必须大于等于0

说明:str_repeat()函数把字符串重复指定的次数

php str_repeat()函数 示例

<?php
$i = "hello world!";
$j = str_repeat($i,3);//设置字符串重复的次数为3
echo $j;
?>

  

原文地址:https://www.cnblogs.com/furuihua/p/11881571.html