Mélangeur de lettres 0.1
Entrez votre texte à mélanger
Texte mélangé';
$chaine = $_POST['texte'];
$tableauchaine = explode(" ", $chaine);
foreach ($tableauchaine as $mot)
{
if(strlen($mot) == '1') { $motcourt = TRUE; }
else $motcourt = FALSE;
$mot = stripslashes($mot);
$finmot = substr($mot, -1);
if($finmot == "," OR $finmot == ".")
{
$finmot = substr($mot, -2);
$modifm = true;
}
else { $modifm = false; }
$debutmot = substr($mot, 0, 1);
if(strpos($mot, "'") OR strpos($mot, "-"))
{
if (strpos($mot, "'")) $carac = "'"; else $carac = "-";
$motapostrophe = explode($carac, $mot);
if(strlen($motapostrophe[0]) >= 2)
{
$debutlettremot = substr($motapostrophe[0], 0, 1);
$finlettremot = substr($motapostrophe[0],-1);
$debutlettremot2 = substr($motapostrophe[1], 0, 1);
if($modifm == true)
{
$mot = substr($motapostrophe[1], 0, -2);
}
else
{
$mot = substr($motapostrophe[1], 0, -1);
}
$mot = substr($mot, 1);
if(strlen($motapostrophe[1]) > 3)
{
$mot = ''.$debutlettremot2.''.str_shuffle($mot).'';
}
else
{
$mot =$motapostrophe[1];
$finmot = '';
}
$debutmot = substr($motapostrophe[0], 0, -1);
$debutmot = substr($debutmot, 1);
$debutmot = "".$debutlettremot."".str_shuffle($debutmot)."".$finlettremot."$carac";
}
else
{
if($modifm == true)
{
$mot = substr($motapostrophe[1], 0, -2);
}
else
{
$mot = substr($motapostrophe[1], 0, -1);
}
$mot = substr($mot, 1);
$mot = str_shuffle($mot);
$debutlettremot2 = substr($motapostrophe[1], 0, 1);
$debutmot = "".$motapostrophe[0]."$carac".$debutlettremot2."";
}
}
else
{
if($modifm == true)
{
$mot = substr($mot, 0, -2);
}
else
{
$mot = substr($mot, 0, -1);
}
$mot = substr($mot, 1);
$mot = str_shuffle($mot);
}
echo $debutmot;
echo $mot;
if ($motcourt!=TRUE) echo $finmot;
echo ' ';
}
}
?>