- 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+1);
-
- $the_texte .= " ".$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_texte .= " ".$le_mot_2_coupe;
-
- if (strlen($le_mot_2) < $limit)
- {
- $the_texte .= " ".$le_mot_2;
- }
- }
- }
- else
- {
- $the_texte .= " ".$le_mot_2;
- }
- }
- else
- {
- $the_texte .= " ".$le_texte[$compt];
- }
- }
- return nl2br($the_texte);
- }
-
-
- Vous pouvez aussi ajouter cette css dans le tableau pour empecher la déformation du tableau au cas ou
-
- .tab{
- word-wrap : break-word;
- word-break : break-all;
- }
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+1);
$the_texte .= " ".$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_texte .= " ".$le_mot_2_coupe;
if (strlen($le_mot_2) < $limit)
{
$the_texte .= " ".$le_mot_2;
}
}
}
else
{
$the_texte .= " ".$le_mot_2;
}
}
else
{
$the_texte .= " ".$le_texte[$compt];
}
}
return nl2br($the_texte);
}
Vous pouvez aussi ajouter cette css dans le tableau pour empecher la déformation du tableau au cas ou
.tab{
word-wrap : break-word;
word-break : break-all;
}