Introduction to Console_Table

Console_Table helps you to display tabular data on a terminal/shell/console. It provides features similar to those of HTML tables: Header and body (data) parts, alignment of columns, cell padding, multi line cells, border "styles" and column filters.

The class be filled with data by adding rows, adding cols or even importing whole arrays.

When adding whole arrays, e.g. a database result, you might want to format the data of certain columns before displaying them. Attaching a formatting callback to a column using Console_Table::addFilter() helps you with that task.

There might be times when you have an array and just want to get it out to the user, without caring about all the small details. Console_Table::fromArray() is the single-line-of-code tool in such cases.

In combination with PEAR's Console_Color package you can format cells by using e.g. different colors for different cell values - very convenient in combination with column filters.