Jump to content

Find and delete strings


akiznin

Recommended Posts

Use file_get_contents / file_put_contents.  In your script, $fh points to stream, not the data as a string.

fopen() binds a named resource, specified by filename , to a stream.

 

$fn = "test.txt";
$file = file_get_contents($fn);
$file = preg_replace('<[^>]*>','',$file);
file_put_contents($fn, $file);

 

Untested.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.