Use file() function... it puts the content of a file in an array... one element of the array is one line of the file...
$fch = file("myfile.txt");
echo "Line 1 = " . $fch[0] . "\n";
First line = $fch[0]
Second line = $fch[1]
etc.
You could use something like this :
$myfile = "myfile.txt;
$line_to_remove = 5; // line 1 = 0, line 2 = 1, ..., line 6 = 5
$lines_of_file = file($myfile);
$fp = fopen($myfile, "w");
for($i = 0; $i < count($lines_of_file); $i++) {
if($i !=$line_to_remove) {
fputs($fp, $lines_of_file[$i] . "\n");
}
}
fclose($fp);