RE: .DAT file with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux