UK [r??pi:t] US [r??pit]
vt. Répéter, réciter
vi Répéter le vote
n. Répéter (programme) répétition; répète Participe présent : répéter Passé : répété Participe passé : répété
Fonction php str_repeat() syntaxe
Comment utiliser la fonction str_repeat() ?
La fonction php str_repeat() est utilisée pour réutiliser la cha?ne spécifiée. La syntaxe est str_repeat(string,repeat). Cette fonction répète la cha?ne un nombre de fois spécifié.
Fonction?: Réutiliser la cha?ne spécifiée
Syntaxe?: str_repeat(string,repeat)
Paramètres?:
Paramètre | Description |
string | Doit être répété String |
repeat | doit spécifier le nombre de fois que la cha?ne est répétée, qui doit être supérieur ou égal à 0 |
Explication : La fonction str_repeat() répète la cha?ne le nombre de fois spécifié
Fonction php str_repeat() exemple
<?php $i = "hello world!"; $j = str_repeat($i,3);//設(shè)置字符串重復(fù)的次數(shù)為3 echo $j; ?>
Exécuter l'instance?
Cliquez sur le bouton ??Exécuter l'instance?? pour afficher l'instance en ligne
Sortie?:
hello world!hello world!hello world!
<?php $i = "Learn PHP to come to php.cn<br>"; $j = str_repeat($i,3); print_r($j); ?>
Exécuter l'instance?
Cliquez sur le bouton ??Exécuter l'instance?? pour voir l'instance en ligne
Sortie?:
Learn PHP to come to php.cn Learn PHP to come to php.cn Learn PHP to come to php.cn