I'm using this code to check if the entered email is existe or not in text file
$handle = fopen("http://mywebsite/u.txt", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
$line = preg_replace('/\s+/', ' ', $line);
if($line=$email){
echo "email existe";
}
}
fclose($handle);
} else {
// error opening the file.
}
the output is the same for exsiting emails and not exsiting email in the text file
email existeemail existeemail existe
the text file contains as a test emails
if i did == it didn't enter the condition when the $line = $email
trying with
echo $line." ".$email;
OUTPUT
[email protected] [email protected]@test.com [email protected]@test.com [email protected]