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 wit
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.ne
Example
";
}
?>
Please note, empty elements will not be handled
btw Any Australian employers want a programmer for awhile?
- Original Message -
From: Sharat Hegde <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 03, 2001 9:55 PM
Subject:
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
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,
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
6 matches
Mail list logo