Console_Table class
This class provides an API to easily generate tables for Console applications (like the tables generated by the MySQL client application in SELECT queries). Eg:
+----------+----------+------------+----------+ | Header 1 | Header 2 | Header 3 | Header 4 | +----------+----------+------------+----------+ | 1 | 2 | 10/08/2002 | 1 | | one | two | 11/08/2002 | 2 | | foo | bar | 12/08/2002 | 3 | +----------+----------+------------+----------+
The code used to generate the above table is:
<?php
include_once('Console/Table.php');
$table = &new Console_Table();
$table->addRow(array(1, 2, 3));
$table->addRow(array('one', 'two', 'three'));
$table->insertRow(array('foo', 'bar'), 2);
$table->addCol(array('1', '2', '3'), 3);
$table->addCol(array('10/08/2002', '11/08/2002', '12/08/2002'), 2);
$table->setHeaders(array('Header 1', 'Header 2', 'Header 3', 'Header 4'));
echo $table->getTable();
?>
This class is available here.