Beginner Friendly · Hands-on · Free

Repeat a string a specified number of times

str_repeat() function string ஐ ஒன்று அல்லது மேற்பட்ட முறை repeat செய்வதற்கு பயன்படுகிறது

5 min read Updated Jan 09, 2026

str_repeat() Function in PHP

str_repeat() function string ஐ ஒன்று அல்லது மேற்பட்ட முறை repeat செய்வதற்கு பயன்படுகிறது.

str_repeat(string,repeat)

Note: str_repeat function இங்கு இரண்டு argument கள் அனுபப்படுகிறது. அவைகள் முறையே string மற்றும் repeat. repeat என்ற argument எத்தனை முறை வரவேண்டுமோ அதன் எண்ணிக்கை கொடுக்க வேண்டும். அதபோல் முதல் argument string ஆனது அனுபப்படுகிறது.

Example1

<?php
echo str_repeat(".*",50);  
?>

மேலே உள்ள Example1-ஐ கவனிக்கவும் str_repeat() function இங்கு ".*" என்ற string முதல் argument ஆகவும் இந்த string 50 முறை repeat ஆக வேண்டும் என்று இரண்டாவது argument ஆக அனுபப்படுகிறது, எனவே இங்கு 50 முறை repeat ஆகியுள்ளது output ஐ கவனிக்கவும்.

Output:

.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*

Example2

<?php
echo str_repeat("=+",20);  
?>

மேலே உள்ள Example2-ஐ கவனிக்கவும் str_repeat() function இங்கு "=+" என்ற string முதல் argument ஆகவும் இந்த string 20 முறை repeat ஆக வேண்டும் என்று இரண்டாவது argument ஆக அனுபப்படுகிறது, எனவே இங்கு 20 முறை repeat ஆகியுள்ளது output ஐ கவனிக்கவும்.

Output:

=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

இது பற்றிய தங்களின் கருத்துகளை இங்கே பதிவிடுங்கள் . இது பயனுள்ளதாக விரும்பினால் மற்றவர்களுக்கும் இதை share செய்யுங்கள்.