[PHP] file() and macintosh line break

2002-05-01 Thread Rodrigo Peres

Hi list,

I'm in a problem that is driving me crazy!!! I want open a file and puts 
each line into an array, but this files was created in macintosh!! so 
the file() can't recognize the end line and only outputs 1 element in 
array!! How can I solve it. I tried to fread() the file and 
eregi_replace the line breaks, it worked, but now I don't know how to 
use this to create the array!

Thank's in advance

Rodrigo


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] file() and macintosh line break

2002-05-01 Thread Darren Gamble

Good day,

Calm down, the excessive !'s are a bit unnecessary.

One possible solution is to read the entire thing into one string, and then
use the split or preg_split function on the \r against it.  This will give
you an array with one line per entry.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


 -Original Message-
 From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 01, 2002 8:55 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] file() and macintosh line break
 
 
 Hi list,
 
 I'm in a problem that is driving me crazy!!! I want open a 
 file and puts 
 each line into an array, but this files was created in macintosh!! so 
 the file() can't recognize the end line and only outputs 1 element in 
 array!! How can I solve it. I tried to fread() the file and 
 eregi_replace the line breaks, it worked, but now I don't know how to 
 use this to create the array!
 
 Thank's in advance
 
 Rodrigo
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php