This works for comma
separated file:
array_map('str_getcsv', file('file.csv'));
but this doesn't work for tab
separated file:
array_map('str_getcsv("\t")', file('file.TLD'));
This should work for you:
array_map(function($v){return str_getcsv($v, "\t");}, file('file.csv'));
Example *.csv
file:
a b c d
1 2 3 4
Output:
Array ( [0] => Array ( [0] => a [1] => b [2] => c [3] => d ) [1] => Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With