maybe this?

while($line = fgets($fp, 1024)) {
    $line = str_replace("replace_this", "with_this", $line);
    $content .= $line;
}

fwrite($fp, $content);

--
Henrik Hansen
----- Original Message -----
From: "enthalpy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 12:29 AM
Subject: [PHP] replacing a line in a file


>
> having problems replacing a line in a file.
>
> need to search the whole document for a string and then replace that line
with a string.
>
> any ideas?
>
> this is causing lots of problems now.
>
> $fpoint3 = fopen ($testshadow, "r+") or die("couldnt open shadow file
again");
> $contents = fread ($fpoint3, $shadowfilesize);
> fputs ($fpoint3, ereg_replace("$data[0]:$shadow[1]", "$data[0]:$data[1]",
$contents));
> fclose ($fpoint3);
>
> any ideas?
>
> <-----CoreComm-Internet-Services---http://core.com----->
> (Jon Marshall                 CoreComm Services Chicago)
> ([EMAIL PROTECTED]         Systems Engineer II)
> ([EMAIL PROTECTED]                   Network Operations)
> <-----Enthalpy.org-------------http://enthalpy.org----->
> ([EMAIL PROTECTED]             The World of Nothing)
> <------------------------------------------------------>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to