A
A
Alexey Verkhovtsev2019-07-04 21:02:35
symfony
Alexey Verkhovtsev, 2019-07-04 21:02:35

How to create CSV using symfony serializer?

Hello. I follow the instructions https://symfony.com/blog/new-in-symfony-3-2-csv-an... What format should the data array have?

$data = [
    'Name' => ['Alex', 'Alex2'],
    'Age' => [26, 20],
];

Name, Age - headers, then data, but it doesn't give me what I need

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2019-07-04
@seftomsk

$data = [
   [
      'Name' => 'Alex',
      'Age' => '26',
   ],
   [
      'Name' => 'Alex2',
      'Age' => '20',
   ],
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question