str_repeat
(PHP 4, PHP 5)
str_repeat — Repite un string
Descripción
string str_repeat
( string
$input
, int $multiplier
)
Devuelve el input repetido
multiplier veces.
Parámetros
-
input -
El string a ser repetido.
-
multiplier -
El número de veces que el string
inputdebe ser repetido.multiplierdebe ser mayor o igual a 0. Si elmultiplierse establece en 0, la función devolverá un string vacío.
Valores devueltos
Devuelve el string repetido.
Ejemplos
Ejemplo #1 Ejemplo de str_repeat()
<?php
echo str_repeat("-=", 10);
?>
El resultado del ejemplo sería:
-=-=-=-=-=-=-=-=-=-=
Ver también
- for
- str_pad() - Rellena un string hasta una longitud determinada con otro string
- substr_count() - Cuenta el número de apariciones del substring