D
D
djalin2015-07-17 15:41:38
PHP
djalin, 2015-07-17 15:41:38

How to parse csv with standard functions?

Hello, I know about php.net/manual/ru/function.fgetcsv.php , but it is not available on the hosting.
Tell me a function, a function, how can I parse a csv file with a record of lines in a tekstik?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Muhammad, 2015-07-17
@muhammad_97

Something like this:

$delimiter = ';';

$csv = file_get_contents('myfile.csv');
$rows = explode(PHP_EOL, $csv);
$data = [];

foreach ($rows as $row)
{
  $data[] = explode($delimiter, $row);
}

print_r($data);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question