2001-07-09 13:45:10 +00:00
|
|
|
<html>
|
|
|
|
<head></head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class Table
|
|
|
|
{
|
|
|
|
var $table_array = array();
|
|
|
|
var $headers = array();
|
|
|
|
var $cols;
|
|
|
|
|
|
|
|
function table($headers)
|
|
|
|
{
|
|
|
|
$this->headers = $headers;
|
|
|
|
$this->cols = count($headers);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addrow($row)
|
|
|
|
{
|
|
|
|
if (count($row) != $this->cols)
|
|
|
|
return false;
|
|
|
|
array_push($this->table_array, $row);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function output()
|
|
|
|
{
|
|
|
|
print "<pre>";
|
|
|
|
foreach($this->headers as $headers)
|
|
|
|
print "<b>$headers</b>";
|
|
|
|
print "\n";
|
|
|
|
foreach($this->table_array as $y)
|
|
|
|
{
|
|
|
|
foreach($y as $xcell)
|
|
|
|
print "$xcell";
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
print "</pre>";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$test = new table(array("a","b","c"));
|
|
|
|
$test->addrow(array(1,2,3));
|
|
|
|
$test->addrow(array(4,5,6));
|
|
|
|
$test->output();
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
2001-07-09 13:37:45 +00:00
|
|
|
</html>
|