Checking URLs for% of correct words [duplicate]

1

I do a check:

if( $nomedoaluno <> str_replace(" ","-",semacentos($arrayReturn['nomedoaluno'])) ){
exit();

and I mount the url www.foo.com/nome-do-aluno

I would like to do a check so that: "If 80% is correct" does not end the program.

Is it possible?

I thought about separating each word and checking:

$array=explode("-",$nomealuno); 

But I do not know what it would look like in the code. Can anyone help me?

It looks like this:

$aluno1 = $nomedoaluno;
$aluno2 = str_replace(" ","-",semacentos($arrayReturn['nomedoaluno']));
if($porcentagem < 80){
exit();
}
    
asked by anonymous 17.08.2018 / 20:12

1 answer

3

You may be testing this similar_text() , see if it solves the problem:

<?php    
    $texto1 = 'Teste com Variavel';
    $texto2 = 'Teste com Var PHP';
    $iguais = similar_text($texto1, $texto2, $porcentagem);

    echo "As duas strings tem $iguais caracteres iguais, com $porcentagem% de igualdade.";
    if($porcentagem >= 80){
        print("Atende a URL");
    }
    else{
        print("Não atende a URL");
    }
?>
    
17.08.2018 / 21:25