Bonjour a tous,
J'ai un ptit souci avec une fonction recalcitrante qui me renvoie une erreur dont je ne connais pas la signification. Cette fonction permet de couper des chaines du type: 80 "a" à la suite.
Le code:
L'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 public static function anti_deforme($texte,$limit) { $le_texte = explode(" ", $texte); $the_text = ""; for($compt = 0 ; $compt<=count($le_texte) ; $compt++) { if (strlen($le_texte[$compt]) > $limit) { $le_mot = substr($le_texte[$compt],0,$limit); $le_mot_2 = substr($le_texte[$compt],$limit); $the_text .= " ".$le_mot; if (strlen($le_mot_2) > $limit) { while (strlen($le_mot_2) > $limit) { $le_mot_2_coupe = substr($le_mot_2,0,$limit); $le_mot_2 = substr($le_mot_2,$limit); $the_text .= " ".$le_mot_2_coupe; if (strlen($le_mot_2) < $limit) { $the_text .= " ".$le_mot_2; } } } else { $the_text .= " ".$le_mot_2; } } else { $the_text .= " ".$le_texte[$compt]; } } return nl2br($the_text); }
Je ne voie vraiment pas de quoi cela peut provenir. Merci d'avance pour tous ceux qui s'atarderons sur le post.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 Undefined offset: 1 --> C:"... .php" ligne 107 Cela correspond a la ligne if (strlen($le_texte[$compt]) > $limit) Undefined offset: 1 --> C:"... .php" ligne 127 Cela correspond a la ligne $the_text .= " ".$le_texte[$compt];
Cordialement
jo
Partager