Okay, I'm trying to clean up some of my code. I had been storing values in their own individual text files, but that's too cluttered.
So I'm thinking an array is the way to go, I can easily use file(); to read the data in as an array, but my problem is writing it back to the file when I'm done manipulating it.
The best I could figure out is
But the resulting "data file" seems to get mangled up because of no carriage returns. Am I approaching this right, or is there a better/easier way?
So I'm thinking an array is the way to go, I can easily use file(); to read the data in as an array, but my problem is writing it back to the file when I'm done manipulating it.
The best I could figure out is
Code:
$fp = fopen($datafile,"w");
foreach ($lines as $line_num => $line) {
$blah = $fwrite($fp,$line);
}
fclose($fp);
But the resulting "data file" seems to get mangled up because of no carriage returns. Am I approaching this right, or is there a better/easier way?