Files
parsecsv-for-php/examples/basic.php
zynode e28b3d0f9d parseCSV 0.3.0
- Changed to the MIT license.

- Added offset and limit options.

- Added SQL-like conditions for quickly
  filtering out entries. Documentation on the
  condition syntax is forthcoming.

- Small parsing modification to comply
  with some recent changes to the specifications
  outlined on Wikipedia's Comma-separated values
  article.

- Minor changes and optimizations, and a few
  spelling corrections. Oops :)

git-svn-id: http://parsecsv-for-php.googlecode.com/svn/trunk@14 339761fc-0c37-0410-822d-8b8cac1f6a97
2007-08-09 09:17:54 +00:00

45 lines
864 B
PHP

<pre>
<?php
# include parseCSV class.
require_once('../parsecsv.lib.php');
# create new parseCSV object.
$csv = new parseCSV();
# Parse '_books.csv' using automatic delimiter detection...
$csv->auto('_books.csv');
# ...or if you know the delimiter, use the parse() function.
// $csv->parse('_books.csv');
# Output result.
// print_r($csv->data);
?>
</pre>
<style type="text/css" media="screen">
table { background-color: #BBB; }
th { background-color: #EEE; }
td { background-color: #FFF; }
</style>
<table border="0" cellspacing="1" cellpadding="3">
<tr>
<?php foreach ($csv->titles as $value): ?>
<th><?php echo $value; ?></th>
<?php endforeach; ?>
</tr>
<?php foreach ($csv->data as $key => $row): ?>
<tr>
<?php foreach ($row as $value): ?>
<td><?php echo $value; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</table>