I have a test.txt
text file with the following contents:
Test Data: some text
Tester 2 Data: some other text
Tests 3 Data: some more
When I run this through my PHP file:
$raw = file("./test.txt");
$lineCount = count($raw);
$newFile = null;
do {
$newFile .= "Data:
";
} while(--$lineCount > 0);
file_put_contents('./test-new.txt',trim($newFile));
I get this:
Data:
Data:
Data:
My preferred output would be:
Data: some text
Data: some other text
Data: some more
What changes do I need to make to my script to get this result?