Utiliser la fonction in_array
	
	
		Bonjour,
Je n'obtiens pas le bon résultat de test avec in_array :
	Code:
	
| 12
 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
 
 | <?php
/*
Contenu de indesirables.txt
   zzz@onlinesuccessmodel.com
  aaa@smtp.fashionesta.com
  BBB@azecris.fr
  ccc@onlinesuccessmodel.com
  DDD@gmail.com
*/
 
$fichier_lire = fopen('indesirables.txt', 'r');
while (!feof($fichier_lire)) {
	$tab_lignes[] = fgets($fichier_lire); 
}
fclose($fichier_lire);
 
echo 'APRES TRAITEMENT'.'<br>';
foreach ($tab_lignes as $ligne)
{ 
  list($prefixe, $suffixe)= explode('@', $ligne); 
  $tab_desirable = array('azecris.fr', 'gmail.com');
  if (!in_array($suffixe, $tab_desirable))
  {
    echo "@".trim($suffixe); 
    echo "<BR>"; 
  } else if (in_array($suffixe, $tab_desirable))
  {
    echo $ligne;
    echo "<BR>"; 
  }
} | 
 APRES TRAITEMENT - erreur :
@onlinesuccessmodel.com
@smtp.fashionesta.com
@azecris.fr
@onlinesuccessmodel.com
@gmail.com
@onlinesuccessmodel.com
@smtp.fashionesta.com
BBB@azecris.fr
@onlinesuccessmodel.com
DDD@gmail.com