This i mainly a PHP question.
I have a file that contains two comments
I would like to search in the file and find the #start and #end tags and replace whatever is between it with custom content.
Here's the code I have so far. This will only replace one line though, which is the #start line only. I need it to replace between the two comments.
$filename = (public_path('/../tests/Browser/mytest.txt')); $find = "#start"; $replace = "whatever"; $file = $filename; $contents = file_get_contents($file); $contents = str_replace($find,$replace,$contents); file_put_contents($file,$contents);
Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.