public function __get($name) { preg_match('#_txt$#', $name, $matches); if (count($matches) == 1) { if (isset($this->{$name})) { return $this->{$name}; } else { throw new Exception('No string in xml language file'); } } else { parent::__get($name); } }