English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Function Manual
The str_repeat() function is used to repeat a string a specified number of times.
str_repeat ( string $string , int $repeat)
It is used to repeat the string (string) a specified (repeat) number of times.
It returns the repeated string
Serial Number | Parameter and Description |
---|---|
1 | string It specifies the string to be repeated |
2 | repeat It specifies the number of times the string is repeated |
Try the following example, repeat the string “w3codebox”Repeat5times and the string “-=”Repeat10times:
<?php //Repeat the string “oldtoolbag.com ”Repeat5times. echo str_repeat("oldtoolbag.com ",5); echo '<br>'; //Repeat the string-Repeat10times. echo str_repeat("-=", 10); ?>Test and See‹/›
Output Result
oldtoolbag.com oldtoolbag.com oldtoolbag.com oldtoolbag.com oldtoolbag.com -=-=-=-=-=-=-=-=-=-=