• PHP Video Tutorials

PHP - Function Str Repeat



Syntax

str_repeat(string,length,pad_string,pad_type)

Definition and Usage

It is used to repeats a string to specific number of times.

Return Values

It returns the repeated string

Parameters

Sr.No Parameters & Description
1

String

It specifies the string to repeat

2

repeat

It specifies the number of times the string to repeat

Example

Try out the following example

<?php
   echo str_repeat("tutorialspoint",5);
?>

This will produce following result −

tutorialspointtutorialspointtutorialspointtutorialspointtutorialspoint
php_function_reference.htm
Advertisements