$list = "/usr/home/username/name.txt";
$oldword = "name";
$results = file($list);
$newword = "";
while (list(,$path) = each($results)){
$parts = explode(':', $path);
$path = $parts[0];
$fp = fopen("$list", 'r');
if ($fp){
$data = fread($fp, filesize($list));
fclose($fp);
$newdata = str_replace($oldword, $newword, $data);
$fp = fopen($list, 'w');
if ($fp){
fwrite($fp, $newdata);
fclose($fp);
}
}
}
This is the way I found out how to do it in one of my scripts. It works just fine for me but I don't know if it delets one whole line or just the value because the thing I'm deleting is the whole line! Hope this helps!