Files correlati : Ricompilazione Demo : [ ] Commento : Prime modifiche git-svn-id: svn://10.65.10.50/trunk@9788 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			55 lines
		
	
	
		
			734 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			734 B
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<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>
 | 
						|
 | 
						|
</html>
 |