How to delete all strings in a txt file which contains some words?
I try to do it using this script:
$f = "somefile.txt";
$str=file_get_contents($f);
$oldMessage=$_POST['label'];
$deletedFormat=' ';
$str=str_replace("$oldMessage", "$deletedFormat",$str);
file_put_contents($f, $str);
But my script deletes only one word not the whole string. Ideas?