From b933e1d96f0fb721187749140ab24ee94146a274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20de=20Guillebon?= Date: Fri, 17 Jun 2016 16:41:01 +0200 Subject: [PATCH] Simplified PHP code again --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 673b473..7502e69 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,9 @@ PHP contributed by @txt3rob ```php function is_temp_mail($mail) { $mail_domains_ko = file('disposable_email_blacklist.conf', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - foreach($mail_domains_ko as $ko_mail) { - list($mail_address, $mail_domain) = explode('@',$mail); - if(strcasecmp($mail_domain, $ko_mail) == 0){ - return true; - } - } - return false; + + //Need to ensure the mail contains an @ to avoid undefined offset + return in_array(explode('@', $mail)[1], $mail_domains_ko); } ```