PHP

PHP Menu

PHP

str_repeat() Function - Definition, Syntax, Parameters, Examples

Definition

The str_repeat() function repeats a string a specified number of times.

Syntax

str_repeat(string, repeat)

Parameters

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.

Example

<?php
echo str_repeat("Hello<br>", 3);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods