[PHP] Parsing a CSV file

2001-10-03 Thread Sharat Hegde
Hello, I am trying to parse a CSV (comma separated file) file to get the separate elements. The format of each line of the file is as follows: R001,23,2,5 Note that the 3rd field 2,5 is enclosed within quotes as it has commas within the field itself. This is a standard file created when an

Re: [PHP] Parsing a CSV file

2001-10-03 Thread alvarez
sure. explode (',', $yourdata) is what you are looking for. use file () to read in the file and use foreach () to iterate over the lines. D. Alvarez Arribas [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

RE: [PHP] Parsing a CSV file

2001-10-03 Thread Niklas Lampén
That won't do if the list is 'R001,23,2,5'. I'd break that to parts with preg_match_all(). Niklas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 3. lokakuuta 2001 15:08 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Parsing a CSV file sure

Re: [PHP] Parsing a CSV file

2001-10-03 Thread Matthew Armsby
for awhile? - Original Message - From: Sharat Hegde [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 03, 2001 9:55 PM Subject: [PHP] Parsing a CSV file Hello, I am trying to parse a CSV (comma separated file) file to get the separate elements. The format of each line

Re: [PHP] Parsing a CSV file

2001-10-03 Thread alvarez
Re: [PHP] Parsing a CSV file there is no need to special-case here, for empty statements would also be handled by repeated calls to explode (). quoted expressions can be joined by preg_matches then. D. Alvarez Arribas [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net

Re: [PHP] Parsing a CSV file

2001-10-03 Thread David Robley
On Wed, 3 Oct 2001 21:25, Sharat Hegde wrote: Hello, I am trying to parse a CSV (comma separated file) file to get the separate elements. The format of each line of the file is as follows: R001,23,2,5 Note that the 3rd field 2,5 is enclosed within quotes as it has commas within the