Re: Array question
| From: | David Robley | Date: | Thu, 17 May 2001 01:10:19 +0000 |
| Subject: | Re: Array question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53134@lists.php.net to get a copy of this message | ||
On Thu, 17 May 2001 08:26, Matthias Roggendorf wrote:
> Hi,
> I wrote some code and I do not understand the result I get:
>
> while ($data = fgetcsv ($fp, 1000, ",")) $line[$j++] = $data;
>
> When I ouput $line[0][0] I get Array[0] instead of the real value.
>
> Why is that?
>
> Thanks for your help,
>
> Matthias
From the docs:
"Similar to fgets() except that fgetcsv() parses the line it reads for
fields in CSV format and returns an array containing the fields read. The
field delimiter is a comma, unless you specify another delimiter with the
optional third parameter."
So it seems that $data will be an array of the current line being
returned from the file? Have a look at the docs
(/manual/en/function.fgetcsv.php) for an example of how to read and
output the contents of a csv file.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
hAS ANYONE SEEN MY cAPSLOCK KEY?