how to add a new line of text after finding a particular string of text in a file, using php ?
Suppose I have the file
and I want add test after the string @add@ , how to do that ?
Are you reading in the entire text file?
There are many ways of doing this, some better suited that others, here's one.
$lines = array();
foreach(file('source.txt') as $line)
if('@add@' === $line)
Fantastic , thank you , really of help
This topic is now closed. New replies are no longer allowed.