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
- test@test.com
- hello@world.com
- test@t.com
if i did == it didn't enter the condition when the $line = $email
trying with
echo $line." ".$email;
OUTPUT
test@test.com test@test.comtest@test.com test@test.comtest@test.com test@test.com