Skip to content

Commit 6d4f657

Browse files
Merge pull request #102 from bonndan/patch-1
Added example how to use custom column widths.
2 parents 6d231e5 + 80ad4d9 commit 6d4f657

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

examples/table.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<?php
22

33
require_once 'common.php';
4-
4+
/*
5+
* Please notice that the data has to be an 0-based array,
6+
* not an associative one if you intend to work with custom
7+
* column widths.
8+
*/
59
$headers = array('First Name', 'Last Name', 'City', 'State');
610
$data = array(
711
array('Maryam', 'Elliott', 'Elizabeth City', 'SD'),
@@ -34,4 +38,5 @@
3438
$table = new \cli\Table();
3539
$table->setHeaders($headers);
3640
$table->setRows($data);
41+
$table->setRenderer(new \cli\table\Ascii([10, 10, 20, 5]));
3742
$table->display();

0 commit comments

Comments
 (0)