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
Example ?php exampleLine = R001,23,\2,5\; preg_match_all (/(\[^\]+\|[^,]+)/, exampleLine, $matches); for ($i=0; $i count($matches[0]); $i++) { echo matched: .$matches[0][$i].br; } ? Please note, empty elements will not be handled btw Any Australian employers want a programmer for

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