Re: How do I read a tab delimited file?
| From: | Matt Parlane | Date: | Tue, 12 Mar 2002 05:32:51 +0000 |
| Subject: | Re: How do I read a tab delimited file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-88155@lists.php.net to get a copy of this message | ||
Hiya...
You can optionally pass a third parameter to fgetscsv which tells it which
delimiter to use - the default is a comma, but you can use "\t" for a tab,
or whatever other delimiters you want.
Just remember to put that \t in double quotes because it's an escape
character.
Matt
"Don" <mail4donpro@rogers.com> wrote in message
news:000c01c1c981$80bcb720$4fad2b18@ym.phub.net.cable.rogers.com...
Hi,
I have a tab delimited file consisting of several lines, one record per line
that I have to process. I don't see a function similar to "fgetcsv" for
TABS so I've used the "file" function to read the whole file into an array,
one line per array element. So far so good.
Now I have to process each line and extract the fields. My question is, how
do I search for the TAB character? Is it as simple as searching on the
ascii code by using the "chr" function? If so, what value do I use in "chr"
to look for TAB?
Thanks,
Don