Fonction str_repeat() | Développement Web

Fonction str_repeat()

La fonction str_repeat permet de répéter $n fois la chaîne de caractère $string.

Utilisation de la fonction str_repeat()

La signature de la fonction str_repeat est la suivante :

str_repeat ( $string , $n );


   $string = 'La fonction str_repeat() ';
   $n = 3;

   echo ( str_repeat( $string , $n ) );

   /* Affiche : La fonction str_repeat() La fonction str_repeat() La fonction str_repeat()*/