// Start here
and
// End here
in this file:
//Start Here
Hello
Goodbye
Testing
Today I went to the mall
//End Here
So basically, I would like to have the script find the line "// Start Here" and begin replaceing everything (and including the line //Start Here) with blankspace until it reaches //End Here
Heres what I have for code now, and I know my preg_replace function is most likely not working:
Code: Select all
<?
$handle=fopen("test.php", "r+");
$data=fread($handle,filesize("test.php"));
preg_replace( '#// Start Here.*?// End Here#gis', '', $data);
fwrite($handle,$data);
fclose($handle);
?>