I meet a strange thing with the PHP function strpos(). I have a function that check if a passed string is found in a txt file. I can display the content of the file line by line but the strpos() doesn't return a value (nothing in fact). var_dump() of the return empty.
Can someone see a mistake, because I am lost. Thank you in advance.
My function :
function checkIfExist($string)
{
$path = "\\\\server\\temp\\test.txt";
$file = file($path);
foreach( $file as $line )
{
echo $line; //display the string in this line
$found = strpos($file,$string);
echo $found; //display nothing, not even a boolean/int
}
return $found;
}