hvad er der forkert?
-------class Tabelle
{
var $tabellen_array = array();
var $koepfe = array();
var $spalten;
function Tabelle ( $koepfe )
{
$this->koepfe = $koepfe;
$this->spalten = count ( $koepfe );
}
function addZeile( $zeile )
{
if (count ($zeile) != $this->spalten)
return false;
array_push ($this->tabellen_array, $zeile);
return true;
}
function addZeileAssozArray ($zeile_assoz)
{
$zeile = array();
foreach ( $this->koepfe as $kopf )
{
if ( ! isset( $zeile_assoz[$kopf] ))
$zeile_assoz[$kopf] = "";
$zeile[] = $zeile_assoz[$kopf];
}
array_push ($this->tabellen_array, $zeile);
return true;
}
function ausgabe()
{
print "<pre>";
foreach ($this->koepfe as $kopf)
print "<b>$kopf</b> ";
print "n";
foreach ($this->tabellen_array as $y)
{
foreach ( $y as $xcell )
print "$xcell ";
print "n";
}
print "</pre>";
}
}
$test = new Tabelle ( array("a", "b", "c"));
$test->addZeile(array("1","2","3"));
$test->addZeile(array(4,5,6));
$test->addZeileAssozArray( array ( b=>0, a=>6, c=>3 ) );
$test->ausgabe();
--------------
