fuel/core — Issue #793: Format Class: to_csv
Author: lukearmstrong
Created: 2012-01-26 16:49:28+00:00
State: open

Am I doing something wrong?

```php
$data = array(
array(
'id',
'targeturl',
'imageurl',
'name',
'price',
'category',
'description'
),
array(
1,
'http://www.example.com/product2',
'http://www.example.com/image2.jpg',
'Product 1',
'20.00',
'Cat: Subcat',
'Test'
),
array(
2,
'http://www.example.com/product2',
'http://www.example.com/image2.jpg',
'Product 2',
'20.00',
'Cat: Subcat',
'Test2'
),
);

$csv = \Format::forge($data)->to_csv();
print_r($csv);
die();
```

Outputs This:

```
0,1,2,3,4,5,6
"id","targeturl","imageurl","name","price","category","description"
"1","http://www.example.com/product2","http://www.example.com/image2.jpg","Product 1","20.00","Cat: Subcat","Test"
"2","http://www.example.com/product2","http://www.example.com/image2.jpg","Product 2","20.00","Cat: Subcat","Test2"
```

Where on earth is the first row coming from? `0,1,2,3,4,5,6`

I can only imagine I am doing something wrong, but I can't tell as the documentation example is converting JSON to a CSV with 2 rows of data with 2 things in each row.