name != $other->name) { throw new Exception("can only compare tables with the same name!"); } foreach (array('fields', 'keys', 'triggers') as $propname) { if (!is_array($this->{$propname})) continue; foreach ($this->{$propname} as $f) { if (!isset($other->{$propname}[$f->name])) { # echo "$propname $f->name is new\n"; return false; } $o = clone $other->{$propname}[$f->name]; $f = clone $f; unset($o->comment); unset($f->comment); if ($f != $o) { # echo "$propname $f->name are not equal\n"; # var_dump($f); # var_dump($o); return false; } } if (!is_array($other->{$propname})) continue; foreach ($other->{$propname} as $f) { if (!isset($this->{$propname}[$f->name])) { # echo "$propname $f->name was deleted\n"; return false; } } } return true; } }