summaryrefslogtreecommitdiffstats
path: root/examples/example03.php
diff options
context:
space:
mode:
authorIgnace Nyamagana Butera <nyamsprod@gmail.com>2014-02-07 10:58:13 +0100
committerIgnace Nyamagana Butera <nyamsprod@gmail.com>2014-02-07 10:58:13 +0100
commit55d02f8f0f987ca5904d34bc56d022e020595d66 (patch)
treeccd2038b5d407bb9084e1cf22bd21392accbe3ff /examples/example03.php
parentbfb61f0f466bba7df3fbc09208a4f40c3460276b (diff)
downloadcsv-55d02f8f0f987ca5904d34bc56d022e020595d66.zip
csv-55d02f8f0f987ca5904d34bc56d022e020595d66.tar.gz
csv-55d02f8f0f987ca5904d34bc56d022e020595d66.tar.bz2
examples update
Diffstat (limited to 'examples/example03.php')
-rw-r--r--examples/example03.php16
1 files changed, 4 insertions, 12 deletions
diff --git a/examples/example03.php b/examples/example03.php
index 3497c00..2eb08e2 100644
--- a/examples/example03.php
+++ b/examples/example03.php
@@ -1,8 +1,5 @@
<?php
-error_reporting(-1);
-ini_set('display_errors', 'On');
-
use Bakame\Csv\Reader;
require '../vendor/autoload.php';
@@ -14,9 +11,8 @@ $inputCsv->setEncoding("iso-8859-15");
//get the header
$headers = $inputCsv->fetchOne(0);
-//get all the data without the header
-$res = $inputCsv->setOffset(1)->fetchAll();
-
+//get at maximum 40 rows starting from the second 801th row
+$res = $inputCsv->setOffset(800)->setLimit(25)->fetchAll();
?>
<!doctype html>
<html lang="fr">
@@ -27,14 +23,10 @@ $res = $inputCsv->setOffset(1)->fetchAll();
<body>
<h1>Example 1: Simple Reader class usage</h1>
<table>
-<caption>Full Statistics</caption>
+<caption>Part of the CSV from the 801th row with at most 25 rows</caption>
<thead>
<tr>
-<?php foreach ($headers as $title): ?>
- <th><?=$title?></th>
- <?php
-endforeach;
-?>
+ <th><?=implode('</th>'.PHP_EOL.'<th>', $headers), '</th>', PHP_EOL; ?>
</tr>
</thead>
<tbody>