<?php
$lines = [
'24/08/2017,email@test.ie,1,2',
'21/05/2018,test@234.com,1,2',
'21/05/2018,test@test.ie,2,2'
];
$found = 0;
$email = 'email@test.ie';
foreach ($lines as $line){
if (strpos($line, $email) !==false){
echo 'email is: ' . $email . PHP_EOL;
$found = true;
$arrayOfLine = explode(",", $line);
$foundGroup = $arrayOfLine[2];
$foundVideo = $arrayOfLine[3];
}
elseif (strpos($line, $email) ===false){
$found = false;
}
}
echo '$found is: '. $found;
preferences:
62.69 ms | 402 KiB | 5 Q