My code is:
$i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file);
For some reason, it writes \n as a string, so the file looks like this:
40119\n40122\n40120\n42155\n36925\n45881\n42145\n45880
At Google, he tells me to use \r\n , but \r is a carriage return, which doesn't seem to be what I want to do. I just want the file to look like this:
40119 40122 40120 42155 36925 45881 42145 45880
Thank.
file php newline fopen linefeed fwrite
VIVA LA NWO Jun 18 '10 at 0:00 2010-06-18 00:00
source share