Hi,
I'm working on adding a new row in text file. I use file() to transfer file
to array and then after recognizing the row with MARK_HERE hadd new row
above the MARK row. It works fine. I use this code:
$AddContent = "Content of the new line...";
$lines = file('old_content.txt');
for($i=0; $i<count($lines); $i++)
{
echo "$i. $lines[$i]<br>";
if(ereg('### MARK_HERE New row comes above this one', $lines[$i]))
{
$NewArray[] = $AddContent;
}
$NewArray[] = $lines[$i];
}
But what then? Code to add new line works fine but can't convert/write back
to new_content.txt file. looking for something opposite then file() -
taking array and writing it in file...
Thanks for any help!
Afan
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- [PHP-WIN] Re: Writing in txt file... Afan Pasalic
- [PHP-WIN] Re: Writing in txt file... Radovan Radic