Convert CSV to PHP Array Online

Form for CSV converting

This form allows you convert CSV to PHP Array, paste or upload your CSV file below:



Your result can be seen below.

Result of CSV conversion to PHP Array


Move to "Paste Code" for Save it

About CSV conversion to PHP Array

About CSV conversion to PHP Array

The Convert CSV to PHP array was created for online converting CSV into appropriate PHP type as Array. This can come in handy for testing or debugging your CSV, also for fast formatting and adding an array of PHP to your config or anywhere else.

How it Works?

Just paste your CSV to the textarea above and click to the button "Convert" and you will get PHP array in the next textarea.

Example of CSV conversion to PHP Array

Before:
"LatS", "NS", "LonD", "LonM", "LonS", "EW", "City", "State"
   59, "N",     80,   39,    0, "W", "Youngstown", OH
   48, "N",     97,   23,   23, "W", "Yankton", SD
   48, "N",     89,   46,   11, "W", "Wisconsin Dells", WI
After:
array (
  0 =>
  array (
    0 => 'LatS',
    1 => 'NS',
    2 => 'LonD',
    3 => 'LonM',
    4 => 'LonS',
    5 => 'EW',
    6 => 'City',
    7 => 'State',
  ),
  1 =>
  array (
    0 => '59',
    1 => 'N',
    2 => '80',
    3 => '39',
    4 => '0',
    5 => 'W',
    6 => 'Youngstown',
    7 => 'OH',
  ),
  2 =>
  array (
    0 => '48',
    1 => 'N',
    2 => '97',
    3 => '23',
    4 => '23',
    5 => 'W',
    6 => 'Yankton',
    7 => 'SD',
  ),
  3 =>
  array (
    0 => '48',
    1 => 'N',
    2 => '89',
    3 => '46',
    4 => '11',
    5 => 'W',
    6 => 'Wisconsin Dells',
    7 => 'WI',
  ),
)
Associative keys:
array (
  0 =>
  array (
    'LatS' => '59',
    'NS' => 'N',
    'LonD' => '80',
    'LonM' => '39',
    'LonS' => '0',
    'EW' => 'W',
    'City' => 'Youngstown',
    'State' => 'OH',
  ),
  1 =>
  array (
    'LatS' => '48',
    'NS' => 'N',
    'LonD' => '97',
    'LonM' => '23',
    'LonS' => '23',
    'EW' => 'W',
    'City' => 'Yankton',
    'State' => 'SD',
  ),
  2 =>
  array (
    'LatS' => '48',
    'NS' => 'N',
    'LonD' => '89',
    'LonM' => '46',
    'LonS' => '11',
    'EW' => 'W',
    'City' => 'Wisconsin Dells',
    'State' => 'WI',
  ),
)
After the conversion, you can apply the PHP array to your project or use it for some other purpose.