Hàm str_repeat () trong PHP
Thí dụ
Lặp lại chuỗi "Wow" 13 lần:
<?php
echo str_repeat("Wow",13);
?>
Định nghĩa và Cách sử dụng
Hàm str_repeat () lặp lại một chuỗi một số lần được chỉ định.
Cú pháp
str_repeat(string,repeat)
Giá trị tham số
Parameter | Description |
---|---|
string | Required. Specifies the string to repeat |
repeat | Required. Specifies the number of times the string will be repeated. Must be greater or equal to 0 |
Chi tiết kỹ thuật
Giá trị trả lại: | Trả về chuỗi lặp lại |
---|---|
Phiên bản PHP: | 4+ |
❮ Tham chiếu chuỗi PHP