tomaskarlik/csvutils

Format array to CSV

1.0 2018-05-12 16:00 UTC

This package is not auto-updated.

Last update: 2024-12-20 19:51:18 UTC


README

Usage

$arrayToCsv = new ArrayToCsvString;

$arrayToCsv->setIncludeBom(TRUE);
$arrayToCsv->setHeader([
	'Header 1',
	'Header 2',
	'Header 3'
]);
$arrayToCsv->addColumnCallback('price', [$this, 'formatFloat']);
$arrayToCsv->addColumnCallback('sales', [$this, 'formatFloat']);
$arrayToCsv->addColumnCallback('cost_of_sales', [$this, 'formatFloat']);

$yourCsvInString = $arrayToCsv->convert($rows);