RE: [PHP] .DAT file with PHP

From: Date: Thu, 09 Mar 2006 03:27:13 +0000
Subject: RE: [PHP] .DAT file with PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-231701@lists.php.net to get a copy of this message
At 07:05 PM 3/8/2006, Jabez wrote:
I used the following code that Paul suggested, but it didn't reverse my content. The file I would want to have the content reversed is as attached. Chinese characters is in the file so... Suggestions?
Jabez, The data in your file is all in one text line. You have inserted the string "<br>" between what I assume are your data elements, but not PHP linefeed characters. Try using "\n" (backslash-n) as your line delimiter and try again. By the way, I neglected to tell you earlier that when file() reads a file into an array, it includes the linefeed characters at the end of each array element. These might or might not get in your way if you're outputting your data to an HTML file -- a linefeed will render as a whitespace character. If you'll be writing the data to another text file where linefeeds are crucial, you may wish to massage the array to ensure that every array element (including the last one read from the original file) ends in \n. Regards, Paul

« previous php.general (#231701) next »