PHP
Chilkat2 PHP
CSV Enable Quotes
Explains the EnableQuotes property for the CSV class.Chilkat PHP Downloads
<?php
use Chilkat2\Csv;
// The CSV in this example contains this: test;"123;abc";xyz
$csv = new Csv();
// EnableQuotes is true by default, but we'll explicitly set to true here:
$csv->EnableQuotes = true;
$csv->LoadFile('qa_data/csv/enableQuotes.csv');
// Show row 0, column 0
echo $csv->GetCell(0, 0), "\n";
// Show row 0, column 1
echo $csv->GetCell(0, 1), "\n";
// Show row 0, column 2
echo $csv->GetCell(0, 2), "\n";
// Output is:
// test
// 123;abc
// xyz
// -------------------------------------------
// Turn off EnableQuotes and see what happens:
$csv2 = new Csv();
$csv2->EnableQuotes = false;
$csv2->LoadFile('qa_data/csv/enableQuotes.csv');
echo $csv2->GetCell(0, 0), "\n";
echo $csv2->GetCell(0, 1), "\n";
echo $csv2->GetCell(0, 2), "\n";
echo $csv2->GetCell(0, 3), "\n";
// Output is:
// test
// "123
// abc"
// xyz