Re: array problem
| From: | Joshua Stoutenburg | Date: | Fri, 09 Sep 2011 16:11:11 +0000 |
| Subject: | Re: array problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314747@lists.php.net to get a copy of this message | ||
The function fgetcsv() returns an array.
http://php.net/manual/en/function.fgetcsv.php
On Fri, Sep 9, 2011 at 9:00 AM, Marc Fromm <Marc.Fromm@wwu.edu> wrote:
> I am reading a csv file into an array. The csv file.
>
> users.csv file contents:
> w12345678,a
> w23456789,b
> w34567890,c
>
> $csvfilename = "users.csv";
> $handle = fopen($csvfilename, "r");
> if($handle) {
> while (($line =
> fgetcsv($handle, 1000, ",")) !== FALSE) {
> $arrUsers[]
> = $line;
> }
> fclose($handle);
> }
>
> When I echo out the elements in the elements in the array $arrUsers I get:
> Array
> Array
> Array
>
> foreach ($arrUsers as $user){
> echo $user . "<br />";
> }
>
> I can't figure out why the word Array is replacing the actual data.
>
>