diff options
author | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2015-02-10 16:18:46 +0100 |
---|---|---|
committer | Ignace Nyamagana Butera <nyamsprod@gmail.com> | 2015-02-10 16:18:46 +0100 |
commit | 7714e0d977364d6d25192c2467cb1c3bf910f4a1 (patch) | |
tree | 7f0f992e4d975e039b184494f2e727d68e66d61e | |
parent | 06d0d3b598ae2b2510a6fd206ebe9de86377b92e (diff) | |
download | csv-7714e0d977364d6d25192c2467cb1c3bf910f4a1.zip csv-7714e0d977364d6d25192c2467cb1c3bf910f4a1.tar.gz csv-7714e0d977364d6d25192c2467cb1c3bf910f4a1.tar.bz2 |
update examples to match current version
-rwxr-xr-x | examples/extract.php | 3 | ||||
-rwxr-xr-x | examples/filtering.php | 3 | ||||
-rwxr-xr-x | examples/switchmode.php | 4 | ||||
-rwxr-xr-x | examples/table.php | 1 |
4 files changed, 5 insertions, 6 deletions
diff --git a/examples/extract.php b/examples/extract.php index 1d78b03..af2d125 100755 --- a/examples/extract.php +++ b/examples/extract.php @@ -9,12 +9,11 @@ require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); $inputCsv->setDelimiter(';'); -$inputCsv->setEncodingFrom("iso-8859-15"); //get the header $headers = $inputCsv->fetchOne(0); -//get at maximum 25 rows starting from the second 801th row +//get at maximum 25 rows starting from the 801th row $res = $inputCsv->setOffset(800)->setLimit(25)->fetchAll(); ?> <!doctype html> diff --git a/examples/filtering.php b/examples/filtering.php index 8948bd5..d6fcf46 100755 --- a/examples/filtering.php +++ b/examples/filtering.php @@ -10,7 +10,6 @@ require '../vendor/autoload.php'; //you can instantiate the Reader class with a SplFileObject object $inputCsv = Reader::createFromPath(new SplFileObject('data/prenoms.csv')); $inputCsv->setDelimiter(';'); -$inputCsv->setEncodingFrom("iso-8859-15"); $res = $inputCsv ->addFilter(function ($row, $index) { @@ -40,7 +39,7 @@ $headers = $inputCsv->fetchOne(0); <!doctype html> <html lang="fr"> <head> - <meta charset="utf-8"> + <meta charset="iso-8859-15"> <title>\League\Csv\Reader filtering method</title> <link rel="stylesheet" href="example.css"> </head> diff --git a/examples/switchmode.php b/examples/switchmode.php index c4d27f3..a654fb1 100755 --- a/examples/switchmode.php +++ b/examples/switchmode.php @@ -48,12 +48,12 @@ $writer->insertAll([ ]); //we create a Reader object from the Writer object -$reader = $writer->getReader(); +$reader = $writer->newReader(); $names = $reader ->addSortBy(function ($row1, $row2) { return strcmp($row1[0], $row2[0]); //we are sorting the name }) - ->fetchCol(); //we only return the name column + ->fetchColumn(); //we only return the name column ?> <!doctype html> <html lang="fr"> diff --git a/examples/table.php b/examples/table.php index 55e024e..8b40f0f 100755 --- a/examples/table.php +++ b/examples/table.php @@ -10,6 +10,7 @@ require '../vendor/autoload.php'; $inputCsv = Reader::createFromPath('data/prenoms.csv'); $inputCsv->setDelimiter(';'); $inputCsv->setEncodingFrom("iso-8859-15"); +$inputCsv->setLimit(30); ?> <!doctype html> <html lang="fr"> |