Well, i now think it is'nt a problem with the explode as this works fine:
$string = "a\nbig\nlong\nsentence";
$search_for = "long";
$array = explode("\n", $string);
$found_key = array_search($search_for, $array);
print $found_key;
but i am bringing in the string from an external file like this.. (and it will only find the last word)
$filename = "external.txt";
$fp = fopen($filename, "rb");
$string = fread ($fp, filesize($filename));
fclose ($fp);
$search_for = "long";
$array = explode("\n", $string);
$found_key = array_search($search_for, $array);
print $found_key;
the external.txt file looks like this...
a
big
long
sentence