PHP str_repeat()ฟังก์ชัน
ตัวอย่าง
ทำซ้ำสตริง "ว้าว" 13 ครั้ง:
<?php
echo str_repeat("Wow",13);
?>
ความหมายและการใช้งาน
ฟังก์ชัน str_repeat() ทำซ้ำสตริงตามจำนวนที่ระบุ
ไวยากรณ์
str_repeat(string,repeat)
ค่าพารามิเตอร์
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 |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ส่งกลับสตริงที่ซ้ำกัน |
---|---|
รุ่น PHP: | 4+ |
❮ การอ้างอิงสตริง PHP