file read and compare with array values and remove the row values from file
fopen("sample.txt",'rb');
read the first column content from file and compare with array value,if it matches then remove the entire row from file.

So. What do you have so far?

sample.txt file has emailaddress,name,...
i.e email1,name1,...
email23,name,...
and in the array have some emailadresses
$arr = array("email1","email2");
so it has to check if the emailaddress is found in the file i need to remove the entire row.

$file_handle = fopen($reportfile, "rb");
$emaillist = array("email1","email2");
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$parts = explode('\n', $line_of_text);
echo $parts[0] ;
if($parts[0] == $emaillist[$i])
{
    //remove the entire row
}
}

how to remove the row from file. and the data is not comparing.

how to remove the row from file

Create a new array containing only the values you want to keep. At the end, overwrite your existing file.

the data is not comparing

$i is not initialized.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.