Comparer un mot avec un dossier file

Résolu
jun_1393 Messages postés 28 Date d'inscription   Statut Membre Dernière intervention   -  
jun_1393 Messages postés 28 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
je travaille sur un code de vigenere depuis un moment et je voudrais faire une fonction qui verifie si le mot entré est bien un mot français , ce mot sera comapré avec different mot qui sont dans un file (dictionnaire )
merci de votre aide.
ceux que j'Ai essayer mais sa marche pas
interface ICryptographie
{
    public function encoder($key, $text);

    public function decoder($key, $text);

    public function regexp($chaine);

    function valider($file_mondic, $text);

    function randomkey();




}

class Crypto implements ICryptographie
{


    function valider($file_mondic, $text){
        $file_mondic = file(__DIR__ . "/Clef/mondic.txt", FILE_IGNORE_NEW_LINES);
        $valid = true;
        foreach ($file_mondic as $text){
            if(strlen($file_mondic == $text) ) { //if string matches
                return $text; //return string if matched
            }else {
                echo "<script>alert(\"le mot ou texte n'Est pas français\")</script>";
            }
        }
A voir également:

1 réponse

jun_1393 Messages postés 28 Date d'inscription   Statut Membre Dernière intervention  
 
toujours la même problématique j'ai essaye d'ajouter une regex pour géré les accents de certain charactere

interface ICryptographie
{
public function encoder($key, $text);

public function decoder($key, $text);

public function regexp($chaine);

function valider($file_mondic, $text);

function randomkey();




}

class Crypto implements ICryptographie
{


function valider($file_mondic, $text){
$file_mondic = file(__DIR__ . "/Clef/mondic.txt", FILE_IGNORE_NEW_LINES);
$valid = true;
foreach ($file_mondic as $text){

$text = strlower($text)
$text = preg_replace("/([jlmtcnds]{1}{'}?\W?/"
if(strlen($file_mondic == $text) ) { //if string matches
return $text; //return string if matched
}else {
echo "<script>alert(\"le mot ou texte n'Est pas français\")</script>";
}
}
0