I have a file named $dir and a string named $line, I know that this string is a complete line of that file but I don\'t know its line number and I
$dir
$line
$contents = file_get_contents($dir); $contents = str_replace($line, '', $contents); file_put_contents($dir, $contents);