Documentación offline PHP master

str_repeat

master Ver versión oficial en línea Licencia CC-BY-3.0Descargado el 2026-08-02

En esta página

str_repeat

Repite un string

Descripción#

str_repeat(string $string, int $times): string
```php

Retorna el string `string` repetido `times` veces.

## Parámetros

`string`  
El string a repetir.

`times`  
Número de veces que el string `string` debe ser multiplicado.

`times` debe ser positivo o nulo. Si `times` es 0, la función retorna el string vacío.

## Valores devueltos

Retorna el string, repetido `times` veces.

## Ejemplos

Ejemplo con `str_repeat`

```php

El ejemplo anterior mostrará:

-=-=-=-=-=-=-=-=-=-=

Véase también#

for, str_pad, substr_count