$searchthis = "LOGIN";
$matches = array();
$handle = @fopen("base.csv", "r");
if ($handle)
{
while (!feof($handle))
{
$buffer = fgets($handle);
if(strpos($buffer, $searchthis) !== FALSE)
$matches[] = $buffer;
}
fclose($handle);
}
print_r($matches);
$textToFind = 'LOGIN PASSWORD DATE ID';
$textToFindArray = explode(' ', $textToFind);
$matchedLines = [];
$lines = file("base.csv");
foreach($lines as $line) {
foreach($textToFindArray as $textToFind) {
if(strpos($line, $textToFind) !== false) {
$matchedLines[] = $line;
}
}
}
print_r($matchedLines);