I'm back with another question and I hope you can help me.
I have a text file with e-mail adresses and names like this:
samplename@sampledomain.com | samplename
samplename@sampledomain.com | samplename
Now I want to transform this text file into a array, so I can proof with "file_get_contents", if an email or name is already in this list or not.
How do I do this?
I already tried many pieces of code, but nothing worked.
Relevant code:
$email = $_GET['email'].PHP_EOL;
$name = $_GET['name'].PHP_EOL;
$file = file_get_contents('anfragen.txt', true);
if (in_array("$name",'$file') || in_array("$email", '$file'))
Error: (caused by the last line of code)
in_array() expects parameter 2 to be array, string given in C:\xampp\htdocs\tutorial2.php on line 9
Why is my code not working? What do I have to change? Pls help me..