-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathtable.php
More file actions
42 lines (40 loc) · 1.87 KB
/
table.php
File metadata and controls
42 lines (40 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
require_once 'common.php';
/*
* Please notice that the data has to be an 0-based array,
* not an associative one if you intend to work with custom
* column widths.
*/
$headers = array('First Name', 'Last Name', 'City', 'State');
$data = array(
array('Maryam', 'Elliott', 'Elizabeth City', 'SD'),
array('Jerry', 'Washington', 'Bessemer', 'ME'),
array('Allegra', 'Hopkins', 'Altoona', 'ME'),
array('Audrey', 'Oneil', 'Dalton', 'SK'),
array('Ruth', 'Mcpherson', 'San Francisco', 'ID'),
array('Odessa', 'Tate', 'Chattanooga', 'FL'),
array('Violet', 'Nielsen', 'Valdosta', 'AB'),
array('Summer', 'Rollins', 'Revere', 'SK'),
array('Mufutau', 'Bowers', 'Scottsbluff', 'WI'),
array('Grace', 'Rosario', 'Garden Grove', 'KY'),
array('Amanda', 'Berry', 'La Habra', 'AZ'),
array('Cassady', 'York', 'Fulton', 'BC'),
array('Heather', 'Terrell', 'Statesboro', 'SC'),
array('Dominic', 'Jimenez', 'West Valley City', 'ME'),
array('Rhonda', 'Potter', 'Racine', 'BC'),
array('Nathan', 'Velazquez', 'Cedarburg', 'BC'),
array('Richard', 'Fletcher', 'Corpus Christi', 'BC'),
array('Cheyenne', 'Rios', 'Broken Arrow', 'VA'),
array('Velma', 'Clemons', 'Helena', 'IL'),
array('Samuel', 'Berry', 'Lawrenceville', 'NU'),
array('Marcia', 'Swanson', 'Fontana', 'QC'),
array('Zachary', 'Silva', 'Port Washington', 'MB'),
array('Hilary', 'Chambers', 'Suffolk', 'HI'),
array('Idola', 'Carroll', 'West Sacramento', 'QC'),
array('Kirestin', 'Stephens', 'Fitchburg', 'AB'),
);
$table = new \cli\Table();
$table->setHeaders($headers);
$table->setRows($data);
$table->setRenderer(new \cli\table\Ascii([10, 10, 20, 5]));
$table->display();