PHP str_repeat() 函数
定义和用法
str_repeat() 函数把字符串重复指定的次数。
语法
str_repeat(string,repeat)参数 描述
string 必需。规定要重复的字符串。
repeat 必需。规定字符串将被重复的次数。必须大于等于 0。
例子
echo str_repeat(".",13);
?>
输出:
.............
例子1
$str = 'jingle bells~, ';
echo '重复输出两次:';
echo '
';
echo str_repeat($str,2);
echo '
';
echo '
';
echo '当函数str_repeat()第2个参数为0时:';
echo '
';
echo 's='.str_repeat($str,0);
?>
输出:
重复输出两次:
jingle bells~, jingle bells~,
当函数str_repeat()第2个参数为0时:
s=