str_repeat

string str_repeat(string string, int multiplier) 

Repeats a string multiplier times.

Returns:

String

Description:

str_repeat() creates a new string that consists of string repeated multiplier times.

Version:

PHP 4.0b4+

Example:
					Print a small Dots-and-Boxes game grid 
<?php 
echo str_repeat (str_repeat (' .', 10) . "\n", 10); 
?> 

Output: 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 
. . . . . . . . . . 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.