Skip to content

rap2hpoutre/csv-to-associative-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CSV to associative array

This package only contains a 587 bytes function: csv_to_associative_array.

What?

Get your CSV file as an associative array. From this:

name,email
raphael,raphael@example.org
lisa,lisa@example.org

To this:

[ 
  ['name' => 'raphael', 'email' => 'raphael@example.org'], 
  ['name' => 'lisa',    'email' => 'lisa@example.org'] 
]

How?

Install via composer

composer require rap2hpoutre/csv-to-associative-array

Use

$content = \Rap2hpoutre\Csv\csv_to_associative_array('path/to/csv/file.csv');