Eu sou iniciante em php. Meu codigo le um arquivo csv e guarda num array. O problema e que eu nao consigo acessar as colunas. Estou usando o php 5.3.3. Alguem sabe como pego a linha e a coluna?
Essa e a minha funcao:
function readCsv($fileName)
{
if(!file_exists($fileName) || !is_readable($fileName)) return false;
$header = null;
$data = array();
$lines = file($fileName);
foreach($lines as $line) {
$values = str_getcsv($line, ',', '\\');
if(!$header) $header = $values;
else $data[] = array_combine($header, $values);
}
return $data;
}
E essa e a minha saida:
Array
(
[Section #] =>
[Q #] => 1
[Q Type] => MAT
[Q Title] =>
[Q Text] => Please rank your 6 preferred sites for your practicum:
[Bonus?] =>
[Difficulty] =>
[Answer] => Boniface (STB)
[Answer Match] => Rank 2
[# Responses] => 0
)
Array
(
[Section #] =>
[Q #] => 1
[Q Type] => MAT
[Q Title] =>
[Q Text] => Please rank your 6 preferred sites for your practicum:
[Bonus?] =>
[Difficulty] =>
[Answer] => Boniface (STB)
[Answer Match] => Rank 2
[# Responses] => 0
)
Array
(
[Section #] =>
[Q #] => 1
[Q Type] => MAT
[Q Title] =>
[Q Text] => Please rank your 6 preferred sites for your practicum:
[Bonus?] =>
[Difficulty] =>
[Answer] => Boniface (STB)
[Answer Match] => Rank 2
[# Responses] => 0
)