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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| <?
//oubli de lettres
function oubli_lettres($sld)
{
$array = preg_split('//',$sld);
$size = sizeof($array);
$size = $size - 1;
for ($i = 1; $i < $size; $i++)
{
if (!strcmp($array[ $i]," ")) { continue; }
for ($x = 1; $x < $size; $x++)
{
if ($x == $i) { continue; }
$temp = $temp . $array[ $x];
}
print "$temp ";
$temp = "";
}
}
//Inversion lettres
function inversion_lettres($sld)
{
$array = preg_split('//',$sld);
$size = sizeof($array);
$size = $size - 1;
for ($i = 1; $i < $size; $i++)
{
if (!strcmp($array[ $i]," ")) { continue; }
if (!strcmp($array[ $i],$array[ $i+1])) { continue; }
for ($x = 1; $x < $size; $x++)
{
if (($x == $i) and ($i < $size)) { $temp = $temp . $array[ $x+1]; }
else if ($x == ($i+1)) {$temp = $temp . $array[ $x-1]; }
else { $temp = $temp . $array[ $x]; }
}
print "$temp ";
$temp = "";
}
}
//Doubler lettres
function doubler_lettres($sld)
{
$array = preg_split('//',$sld);
$size = sizeof($array);
$size = $size - 1;
for ($i = 1; $i < $size; $i++)
{
if (!strcmp($array[ $i]," ")) { continue; }
for ($x = 1; $x < $size; $x++)
{
$temp = $temp . $array[ $x];
if ($x == $i) { $temp = $temp . $array[ $x] ; }
}
print "$temp ";
$temp = "";
}
}
//Erreur communes clavier azerty
function erreur_lettres_proches($sld)
{
$alphabet = Array(
a => array("z"),
z => array("a", "e"),
e => array("z", "r"),
r => array("e", "t"),
t => array("r", "y"),
y => array("t", "u"),
u => array("y", "i"),
i => array("u", "o"),
o => array("i", "p"),
p => array("o"),
q => array("s"),
s => array("q", "d"),
d => array("s", "f"),
f => array("d", "g"),
g => array("f", "h"),
h => array("g", "j"),
j => array("h", "k"),
k => array("j", "l"),
l => array("k", "m"),
m => array("l"),
w => array("x"),
x => array("w", "c"),
c => array("x", "v"),
v => array("c", "b"),
b => array("v", "n"),
n => array("b")
);
$sld = strtolower($sld);
$array = preg_split('//',$sld);
$size = sizeof($array);
$size = $size - 1;
for ($i = 1; $i < $size; $i++)
{
if (!strcmp($array[ $i]," ")) { continue; }
$current_letter = $array[$i];
if ( !$alphabet[$current_letter][0] ) { continue; }
$number_of_missed_keys = sizeof($alphabet[$current_letter]);
for ($x = 0; $x < $number_of_missed_keys; $x++)
{
for ($z = 1; $z < $size; $z++)
{
if ($i == $z) { $temp = $temp . $alphabet[$current_letter][$x] ; }
else { $temp = $temp . $array[ $z]; }
}
print "$temp ";
$temp = "";
}
}
}
?> |
Partager