Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new array syntax in docs #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,18 @@ use Goodby\CSV\Import\Standard\Lexer;
use Goodby\CSV\Import\Standard\Interpreter;
use Goodby\CSV\Import\Standard\LexerConfig;

$temperature = array();
$temperature = [];

$config = new LexerConfig();
$config->setDelimiter("\t");
$lexer = new Lexer($config);

$interpreter = new Interpreter();
$interpreter->addObserver(function(array $row) use (&$temperature) {
$temperature[] = array(
$temperature[] = [
'temperature' => $row[0],
'city' => $row[1],
);
];
});

$lexer->parse('temperature.tsv', $interpreter);
Expand All @@ -201,11 +201,11 @@ use Goodby\CSV\Export\Standard\ExporterConfig;
$config = new ExporterConfig();
$exporter = new Exporter($config);

$exporter->export('php://output', array(
array('1', 'alice', '[email protected]'),
array('2', 'bob', '[email protected]'),
array('3', 'carol', '[email protected]'),
));
$exporter->export('php://output', [
['1', 'alice', '[email protected]'],
['2', 'bob', '[email protected]'],
['3', 'carol', '[email protected]'],
]);
```


Expand Down Expand Up @@ -240,10 +240,10 @@ use Goodby\CSV\Export\Standard\ExporterConfig;

use Goodby\CSV\Export\Standard\Collection\CallbackCollection;

$data = array();
$data[] = array('user', 'name1');
$data[] = array('user', 'name2');
$data[] = array('user', 'name3');
$data = [];
$data[] = ['user', 'name1'];
$data[] = ['user', 'name2'];
$data[] = ['user', 'name3'];

$collection = new CallbackCollection($data, function($row) {
// apply custom format to the row
Expand Down