i have a very simple script that reads out a txt file, puts the content in an array.
Which does perfectly, i can do print_r($array)
; and it outputs all the data.
My script:
<?php
$file = 'countries.txt';
$countries_output = file_get_contents($file);
$countries_pieces = explode("\n", $countries_output);
if (in_array("Sweden", $countries_pieces)) {
echo "Sweden was found";
}
else
{
echo'NOT FOUND';
}
print_r($countries_pieces);
?>
I don't understand why it doesn't find the value 'Sweden' in my array, when it clearly is in there.
This is the output: https://pastebin.com/z9rC9Qvk
I also print_r the array, so you can see that 'Sweden' is indeed in the array.
Hope someone can help :)